diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php index 61154b790fb..1cf69b6086c 100644 --- a/htdocs/compta/paiement/rapport.php +++ b/htdocs/compta/paiement/rapport.php @@ -27,6 +27,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/includes/modules/rapport/pdf_paiement.class.php"); $user->getrights("facture"); @@ -50,7 +51,6 @@ if ($user->societe_id > 0) $year = $_GET["year"]; if (! $year) { $year=date("Y"); } -require("../../includes/modules/rapport/pdf_paiement.class.php"); diff --git a/htdocs/includes/modules/rapport/pdf_paiement.class.php b/htdocs/includes/modules/rapport/pdf_paiement.class.php index af4bad19c51..5c0ab15d6ec 100644 --- a/htdocs/includes/modules/rapport/pdf_paiement.class.php +++ b/htdocs/includes/modules/rapport/pdf_paiement.class.php @@ -44,129 +44,116 @@ class pdf_paiement function pdf_paiement($db=0) { global $langs; + $langs->load("bills"); $this->db = $db; - $this->description = "Liste des paiements"; - - $this->url = DOL_URL_ROOT."/document/rapport/" . "paiements" . ".pdf"; + $this->description = $langs->trans("ListOfCustomerPayments"); $this->tab_top = 30; $this->line_height = 5; $this->line_per_page = 25; $this->tab_height = 230; //$this->line_height * $this->line_per_page; + } - - - function print_link() - { - if (file_exists($this->file)) + + + function Header(&$pdf, $page, $pages) { - print 'paiements.pdf'; - print ''; - print ''; - print ''; - print '
'.filesize($this->file). ' bytes'.strftime("%d %b %Y %H:%M:%S",filemtime($this->file)).'
'; + global $langs; + + $title=$this->description.' - '.dolibarr_print_date(mktime(0,0,0,$this->month),"%B"); + $pdf->SetFont('Arial','B',12); + $pdf->Text(76, 10, $title); + + $pdf->SetFont('Arial','B',12); + $pdf->Text(11, 16, $langs->trans("Date")." : ".dolibarr_print_date(time(),"%d %b %Y")); + + $pdf->SetFont('Arial','',12); + $pdf->Text(11, 22, $langs->trans("Page")." : ".$page); + // $pdf->Text(11, 22, "Page " . $page . " sur " . $pages); + + $pdf->SetFont('Arial','',12); + + $pdf->Text(11,$this->tab_top + 6,'Date'); + + $pdf->line(40, $this->tab_top, 40, $this->tab_top + $this->tab_height + 10); + $pdf->Text(42, $this->tab_top + 6, $langs->trans("PaymentType")); + + $pdf->line(80, $this->tab_top, 80, $this->tab_top + $this->tab_height + 10); + $pdf->Text(82, $this->tab_top + 6, $langs->trans("Invoice")); + + $pdf->line(120, $this->tab_top, 120, $this->tab_top + $this->tab_height + 10); + $pdf->Text(122, $this->tab_top + 6, $langs->trans("AmountInvoice")); + + $pdf->line(160, $this->tab_top, 160, $this->tab_top + $this->tab_height + 10); + + $pdf->SetXY (160, $this->tab_top); + $pdf->MultiCell(40, 10, $langs->trans("AmountPayment"), 0, 'R'); + + $pdf->line(10, $this->tab_top + 10, 200, $this->tab_top + 10 ); + + $pdf->Rect(9, $this->tab_top, 192, $this->tab_height + 10); } - } - function Header(&$pdf, $page, $pages) - { - global $langs; - - $pdf->SetFont('Arial','B',12); - $pdf->Text(90, 10, $langs->trans("PaimentsList")); - - $pdf->SetFont('Arial','B',12); - $pdf->Text(11, 16, "Date : " . strftime("%d %b %Y", time())); - - $pdf->SetFont('Arial','B',12); - $pdf->Text(11, 22, "Page " . $page); - // $pdf->Text(11, 22, "Page " . $page . " sur " . $pages); - - $pdf->SetFont('Arial','',12); - - $pdf->Text(11,$this->tab_top + 6,'Date'); - - $pdf->line(40, $this->tab_top, 40, $this->tab_top + $this->tab_height + 10); - $pdf->Text(42, $this->tab_top + 6,'Type paiement'); - - $pdf->line(80, $this->tab_top, 80, $this->tab_top + $this->tab_height + 10); - $pdf->Text(82, $this->tab_top + 6,'Facture'); - - $pdf->line(120, $this->tab_top, 120, $this->tab_top + $this->tab_height + 10); - $pdf->Text(122, $this->tab_top + 6,'Montant Fac'); - - $pdf->line(160, $this->tab_top, 160, $this->tab_top + $this->tab_height + 10); - - $pdf->SetXY (160, $this->tab_top); - $pdf->MultiCell(40, 10, "Montant", 0, 'R'); - - $pdf->Rect(10, $this->tab_top, 190, $this->tab_height + 10); - $pdf->line(10, $this->tab_top + 10, 200, $this->tab_top + 10 ); - - } - - function Body(&$pdf, $page, $lines) - { - $pdf->SetFont('Arial','', 9); - $oldprowid = 0; - $pdf->SetFillColor(220,220,220); - $yp = 0; - for ($j = 0 ; $j < sizeof($lines) ; $j++) + function Body(&$pdf, $page, $lines) { - $i = $j; - if ($oldprowid <> $lines[$j][7]) - { - if ($yp > 200) + $pdf->SetFont('Arial','', 9); + $oldprowid = 0; + $pdf->SetFillColor(220,220,220); + $yp = 0; + for ($j = 0 ; $j < sizeof($lines) ; $j++) { - $page++; - $pdf->AddPage(); - $this->Header($pdf, $page, $pages); - $pdf->SetFont('Arial','', 9); - $yp = 0; + $i = $j; + if ($oldprowid <> $lines[$j][7]) + { + if ($yp > 200) + { + $page++; + $pdf->AddPage(); + $this->Header($pdf, $page, $pages); + $pdf->SetFont('Arial','', 9); + $yp = 0; + } + + + $pdf->SetXY (10, $this->tab_top + 10 + $yp); + $pdf->MultiCell(30, $this->line_height, $lines[$j][1], 0, 'J', 1); + + $pdf->SetXY (40, $this->tab_top + 10 + $yp); + $pdf->MultiCell(80, $this->line_height, $lines[$j][2].' '.$lines[$j][3], 0, 'J', 1); + + $pdf->SetXY (120, $this->tab_top + 10 + $yp); + $pdf->MultiCell(40, $this->line_height, '', 0, 'J', 1); + + $pdf->SetXY (160, $this->tab_top + 10 + $yp); + $pdf->MultiCell(40, $this->line_height, $lines[$j][4], 0, 'R', 1); + $yp = $yp + 5; + } + + $pdf->SetXY (80, $this->tab_top + 10 + $yp); + $pdf->MultiCell(40, $this->line_height, $lines[$j][0], 0, 'J', 0); + + $pdf->SetXY (120, $this->tab_top + 10 + $yp); + $pdf->MultiCell(40, $this->line_height, $lines[$j][5], 0, 'J', 0); + + $pdf->SetXY (160, $this->tab_top + 10 + $yp); + $pdf->MultiCell(40, $this->line_height, $lines[$j][6], 0, 'R', 0); + $yp = $yp + 5; + + if ($oldprowid <> $lines[$j][7]) + { + $oldprowid = $lines[$j][7]; + } + + // if ($i < $this->line_per_page - 1) + // { + // $pdf->line(10, $this->tab_top + 10 + (($i+1) * $this->line_height), 200, $this->tab_top + 10 + (($i+1) * $this->line_height)); + // } + } - - - $pdf->SetXY (10, $this->tab_top + 10 + $yp); - $pdf->MultiCell(30, $this->line_height, $lines[$j][1], 0, 'J', 1); - - $pdf->SetXY (40, $this->tab_top + 10 + $yp); - $pdf->MultiCell(40, $this->line_height, $lines[$j][2], 0, 'J', 1); - - $pdf->SetXY (80, $this->tab_top + 10 + $yp); - $pdf->MultiCell(40, $this->line_height, '', 0, 'J', 1); - - $pdf->SetXY (120, $this->tab_top + 10 + $yp); - $pdf->MultiCell(40, $this->line_height, $lines[$j][3], 0, 'J', 1); - - $pdf->SetXY (160, $this->tab_top + 10 + $yp); - $pdf->MultiCell(40, $this->line_height, $lines[$j][4], 0, 'R', 1); - $yp = $yp + 5; - } - - $pdf->SetXY (80, $this->tab_top + 10 + $yp); - $pdf->MultiCell(40, $this->line_height, $lines[$j][0], 0, 'J', 0); - - $pdf->SetXY (120, $this->tab_top + 10 + $yp); - $pdf->MultiCell(40, $this->line_height, $lines[$j][5], 0, 'J', 0); - - $pdf->SetXY (160, $this->tab_top + 10 + $yp); - $pdf->MultiCell(40, $this->line_height, $lines[$j][6], 0, 'R', 0); - $yp = $yp + 5; - - if ($oldprowid <> $lines[$j][7]) - { - $oldprowid = $lines[$j][7]; - } - - // if ($i < $this->line_per_page - 1) - // { - // $pdf->line(10, $this->tab_top + 10 + (($i+1) * $this->line_height), 200, $this->tab_top + 10 + (($i+1) * $this->line_height)); - // } } - } /** @@ -179,6 +166,9 @@ class pdf_paiement { global $langs; + $this->month=$month; + $this->year=$year; + $dir=$_dir.'/'.$year; if (! is_dir($dir)) @@ -208,9 +198,8 @@ class pdf_paiement $sql .= " WHERE pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid"; - $sql .= " AND date_format(p.datep, '%Y') = " . $year; $sql .= " AND p.fk_paiement = c.id "; - // $sql .= " AND date_format(p.datep, '%m%Y') = " . $month.$year; + $sql .= " AND date_format(p.datep, '%Y%m') = " . sprintf("%04d%02d",$year,$month); $sql .= " ORDER BY p.datep ASC, pf.fk_paiement ASC"; $result = $this->db->query($sql); // print $sql ; @@ -227,7 +216,7 @@ class pdf_paiement $var=!$var; $lines[$i][0] = $objp->facnumber; - $lines[$i][1] = strftime("%d %B %Y",$objp->dp); + $lines[$i][1] = dolibarr_print_date($objp->dp,"%d %B %Y"); $lines[$i][2] = $objp->paiement_type ; $lines[$i][3] = $objp->num_paiement; $lines[$i][4] = price($objp->paiement_amount); @@ -260,13 +249,11 @@ class pdf_paiement */ $pdf->AddPage(); + $this->Header($pdf, 1, $pages); + $this->Body($pdf, 1, $lines); - /* - * - */ - $pdf->Output($_file); } diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index f1b3ee2218d..8f83d440464 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -37,6 +37,8 @@ SupplierBills=suppliers invoices BillContacts=Invoice contacts Payment=Payment Payments=Payments +PaymentType=Payment type +PaymentTypes=Payment types ReceivedPayments=Received payments ReceivedCustomersPayments=Received customers payments ReceivedCustomersPaymentsToValid=Received customers payments to validate diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 0ada3d471f2..03e81ed7f61 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -37,6 +37,8 @@ NewPayment=New payment Payments=Payments ListPayment=List of payments ListOfPayments=List of payments +ListOfCustomerPayments=List of customer payments +ListOfSupplierPayments=Liste of supplier payments RulesResultDue=- Il inclut les factures, charges et tva dues, qu'elles soient payées ou non.
- Il se base sur la date de validation pour les factures et tva, les dates d'échéances pour les charges.
RulesResultInOut=- Il inclut les paiements effectivement réalisés des factures, charges et tva.
- Il se base sur la date des paiements de ces factures, charges et tva.
RulesCADue=- Il inclut les factures clients dues, qu'elles soient payées ou non.
- Il se base sur la date de validation de ces factures.
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 4ef2490f311..c0cb00e8832 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -174,6 +174,8 @@ PriceU=U.P. PriceUHT=U.P. HT PriceUTTC=U.P. TTC Amount=Amount +AmountInvoice=Amount invoice +AmountPayment=Amount payment AmountHT=Amount HT AmountTTC=Amount TTC AmountVAT=Amount VAT diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 20f3b9183e7..f3c5df54fa2 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -37,6 +37,8 @@ SupplierBills=Factures fournisseurs BillContacts=Contacts facture Payment=Paiement Payments=Paiements +PaymentType=Type de paiement +PaymentTypes=Types de paiements ReceivedPayments=Paiements reçus ReceivedCustomersPayments=Paiements clients reçus ReceivedCustomersPaymentsToValid=Paiements clients reçus à valider diff --git a/htdocs/langs/fr_FR/compta.lang b/htdocs/langs/fr_FR/compta.lang index 60ce5cd6fff..ee0c53ebb6e 100644 --- a/htdocs/langs/fr_FR/compta.lang +++ b/htdocs/langs/fr_FR/compta.lang @@ -37,6 +37,8 @@ NewPayment=Nouveau paiement Payments=Paiements ListPayment=Liste des paiements ListOfPayments=Liste des paiements +ListOfCustomerPayments=Liste des paiements clients +ListOfSupplierPayments=Liste des paiements fournisseurs RulesResultDue=- Il inclut les factures, charges et tva dues, qu'elles soient payées ou non.
- Il se base sur la date de validation pour les factures et la tva et sur la date d'échéance pour les charges.
RulesResultInOut=- Il inclut les paiements effectivement réalisés pour les factures, les charges et la TVA.
- Il se base sur la date de paiement de ces factures, charges et TVA.
RulesCADue=- Il inclut les factures clients dues, qu'elles soient payées ou non.
- Il se base sur la date de validation de ces factures.
diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 341c8156f45..5273f1a1b79 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -174,6 +174,8 @@ PriceU=P.U. PriceUHT=P.U. HT PriceUTTC=P.U. TTC Amount=Montant +AmountInvoice=Montant facture +AmountPayment=Montant paiement AmountHT=Montant HT AmountTTC=Montant TTC AmountVAT=Montant TVA