diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index 645fff6adf1..f2f9f83f67c 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -104,7 +104,7 @@ print ''; print ''; if (isModEnabled('propal')) { - print load_fiche_titre($langs->trans("Proposal"), '', ''); + print load_fiche_titre($langs->trans("Proposal"), '', 'proposal'); print '
'; print ''; @@ -127,7 +127,7 @@ if (isModEnabled('propal')) { if (isModEnabled('facture')) { - print load_fiche_titre($langs->trans("Invoices"), '', ''); + print load_fiche_titre($langs->trans("Invoices"), '', 'bill'); print '
'; print '
'; @@ -170,6 +170,42 @@ if (isModEnabled('facture')) { print ''; } + + +if (isModEnabled('reception')) { + print load_fiche_titre($langs->trans("Receptions"), '', 'reception'); + + print '
'; + print '
'; + print ''; + + print ''; + + print ''; + + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + print $langs->trans("RECEPTION_PDF_HIDE_ORDERED"); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('RECEPTION_PDF_HIDE_ORDERED'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("RECEPTION_PDF_HIDE_ORDERED", $arrval, $conf->global->RECEPTION_PDF_HIDE_ORDERED); + } + print '
'; + print $langs->trans("MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT"); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT", $arrval, $conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT); + } + print '
'; + print '
'; +} + + print '
'; print ''; print '
'; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2a2675ed7bd..90bf079f687 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3977,7 +3977,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'label', 'language', 'line', 'link', 'list', 'list-alt', 'listlight', 'loan', 'lot', 'long-arrow-alt-right', 'margin', 'map-marker-alt', 'member', 'meeting', 'money-bill-alt', 'movement', 'mrp', 'note', 'next', 'off', 'on', 'order', - 'paiment', 'paragraph', 'play', 'pdf', 'phone', 'phoning', 'phoning_mobile', 'phoning_fax', 'playdisabled', 'previous', 'poll', 'pos', 'printer', 'product', 'propal', 'puce', + 'paiment', 'paragraph', 'play', 'pdf', 'phone', 'phoning', 'phoning_mobile', 'phoning_fax', 'playdisabled', 'previous', 'poll', 'pos', 'printer', 'product', 'propal', 'proposal', 'puce', 'stock', 'resize', 'service', 'stats', 'trip', 'security', 'setup', 'share-alt', 'sign-out', 'split', 'stripe', 'stripe-s', 'switch_off', 'switch_on', 'switch_on_red', 'tools', 'unlink', 'uparrow', 'user', 'user-tie', 'vcard', 'wrench', 'github', 'google', 'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp', @@ -4029,7 +4029,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'intervention'=>'ambulance', 'invoice'=>'file-invoice-dollar', 'currency'=>'dollar-sign', 'multicurrency'=>'dollar-sign', 'order'=>'file-invoice', 'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle', 'other'=>'square', - 'playdisabled'=>'play', 'pdf'=>'file-pdf', 'poll'=>'check-double', 'pos'=>'cash-register', 'preview'=>'binoculars', 'project'=>'project-diagram', 'projectpub'=>'project-diagram', 'projecttask'=>'tasks', 'propal'=>'file-signature', + 'playdisabled'=>'play', 'pdf'=>'file-pdf', 'poll'=>'check-double', 'pos'=>'cash-register', 'preview'=>'binoculars', 'project'=>'project-diagram', 'projectpub'=>'project-diagram', 'projecttask'=>'tasks', 'propal'=>'file-signature', 'proposal'=>'file-signature', 'partnership'=>'handshake', 'payment'=>'money-check-alt', 'payment_vat'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'previous'=>'arrow-alt-circle-left', 'printer'=>'print', 'product'=>'cube', 'puce'=>'angle-right', 'recent' => 'question', 'reception'=>'dolly', 'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge', 'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature', @@ -4111,7 +4111,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'holiday'=>'infobox-holiday', 'info'=>'opacityhigh', 'invoice'=>'infobox-commande', 'knowledgemanagement'=>'infobox-contrat rotate90', 'loan'=>'infobox-bank_account', 'payment'=>'infobox-bank_account', 'payment_vat'=>'infobox-bank_account', 'poll'=>'infobox-adherent', 'pos'=>'infobox-bank_account', 'project'=>'infobox-project', 'projecttask'=>'infobox-project', - 'propal'=>'infobox-propal', 'private'=>'infobox-project', + 'propal'=>'infobox-propal', 'proposal'=>'infobox-propal','private'=>'infobox-project', 'reception'=>'flip', 'recruitmentjobposition'=>'infobox-adherent', 'recruitmentcandidature'=>'infobox-adherent', 'resource'=>'infobox-action', 'salary'=>'infobox-bank_account', 'shipment'=>'infobox-commande', 'supplier_invoice'=>'infobox-order_supplier', 'supplier_invoicea'=>'infobox-order_supplier', 'supplier_invoiced'=>'infobox-order_supplier', diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index 93c8f33cfd5..fb0e59fcb3a 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -353,6 +353,8 @@ class pdf_squille extends ModelePdfReception $nexY = $tab_top + 7; $fk_commandefourndet = 0; $totalOrdered = 0; + $totalAmount = 0; + // Loop on each lines for ($i = 0; $i < $nblines; $i++) { $curY = $nexY; @@ -479,6 +481,7 @@ class pdf_squille extends ModelePdfReception $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut + // Description $pdf->SetXY($this->posxweightvol, $curY); $weighttxt = ''; if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->product->weight) { @@ -492,6 +495,7 @@ class pdf_squille extends ModelePdfReception $pdf->writeHTMLCell($this->posxqtyordered - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt) ? '
' : '').$voltxt, 0, 0, false, true, 'C'); //$pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), 3, $weighttxt.(($weighttxt && $voltxt)?'
':'').$voltxt,'','C'); + // Qty ordered if (empty($conf->global->RECEPTION_PDF_HIDE_ORDERED)) { $pdf->SetXY($this->posxqtyordered, $curY); if ($object->lines[$i]->fk_commandefourndet != $fk_commandefourndet) { @@ -501,15 +505,20 @@ class pdf_squille extends ModelePdfReception $fk_commandefourndet = $object->lines[$i]->fk_commandefourndet; } + // Qty received $pdf->SetXY($this->posxqtytoship, $curY); $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 3, $object->lines[$i]->qty, '', 'C'); + // Amount if (!empty($conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT)) { $pdf->SetXY($this->posxpuht, $curY); $pdf->MultiCell(($this->posxtotalht - $this->posxpuht - 1), 3, price($object->lines[$i]->subprice, 0, $outputlangs), '', 'R'); + $amountreceived = price2num($object->lines[$i]->subprice * $object->lines[$i]->qty, 'MT'); $pdf->SetXY($this->posxtotalht, $curY); - $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxtotalht), 3, price($object->lines[$i]->total_ht, 0, $outputlangs), '', 'R'); + $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxtotalht), 3, price($amountreceived, 0, $outputlangs), '', 'R'); + + $totalAmount += $amountreceived; } $nexY += 3; @@ -568,7 +577,7 @@ class pdf_squille extends ModelePdfReception } // Affiche zone totaux - $posy = $this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs, $totalOrdered); + $posy = $this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs, $totalOrdered, $totalAmount); // Pied de page $this->_pagefoot($pdf, $object, $outputlangs); @@ -616,9 +625,10 @@ class pdf_squille extends ModelePdfReception * @param int $posy Position depart * @param Translate $outputlangs Objet langs * @param int $totalOrdered Total ordered + * @param int $totalAmount Total amount * @return int Position pour suite */ - protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs, $totalOrdered) + protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs, $totalOrdered, $totalAmount = 0) { // phpcs:enable global $conf, $mysoc; @@ -680,41 +690,46 @@ class pdf_squille extends ModelePdfReception $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("Total"), 0, 'L', 1); + $index2 = 0; + + // Total Weight + if ($totalWeighttoshow) { + $pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * ($index + $index2)); + $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalWeighttoshow, 0, 'C', 1); + $index2++; + } + if ($totalVolumetoshow) { + $pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * ($index + $index2)); + $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalVolumetoshow, 0, 'C', 1); + $index2++; + } + + // Total qty ordered if (empty($conf->global->RECEPTION_PDF_HIDE_ORDERED)) { $pdf->SetXY($this->posxqtyordered, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($this->posxqtytoship - $this->posxqtyordered, $tab2_hl, $totalOrdered, 0, 'C', 1); } + // Total received $pdf->SetXY($this->posxqtytoship, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($this->posxpuht - $this->posxqtytoship, $tab2_hl, $totalToShip, 0, 'C', 1); + // Amount if (!empty($conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT)) { $pdf->SetXY($this->posxpuht, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($this->posxtotalht - $this->posxpuht, $tab2_hl, '', 0, 'C', 1); $pdf->SetXY($this->posxtotalht, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxtotalht, $tab2_hl, price($object->total_ht, 0, $outputlangs), 0, 'C', 1); - } - - // Total Weight - if ($totalWeighttoshow) { - $pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalWeighttoshow, 0, 'C', 1); - - $index++; - } - if ($totalVolumetoshow) { - $pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalVolumetoshow, 0, 'C', 1); - - $index++; - } - if (!$totalWeighttoshow && !$totalVolumetoshow) { - $index++; + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxtotalht, $tab2_hl, price($totalAmount, 0, $outputlangs), 0, 'C', 1); } $pdf->SetTextColor(0, 0, 0); + $index++; + if ($index2) { + $index++; + } + return ($tab2_top + ($tab2_hl * $index)); } @@ -754,6 +769,7 @@ class pdf_squille extends ModelePdfReception $pdf->SetDrawColor(128, 128, 128); $pdf->SetFont('', '', $default_font_size - 1); + // Description if (empty($hidetop)) { $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); @@ -761,12 +777,14 @@ class pdf_squille extends ModelePdfReception $pdf->MultiCell($this->posxqtyordered - $this->posxdesc, 2, $outputlangs->transnoentities("Description"), '', 'L'); } + // Volume / Weight $pdf->line($this->posxweightvol - 1, $tab_top, $this->posxweightvol - 1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxweightvol - 1, $tab_top + 1); $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), 2, $outputlangs->transnoentities("WeightVolShort"), '', 'C'); } + // Qty ordered if (empty($conf->global->RECEPTION_PDF_HIDE_ORDERED)) { $pdf->line($this->posxqtyordered - 1, $tab_top, $this->posxqtyordered - 1, $tab_top + $tab_height); if (empty($hidetop)) { @@ -775,6 +793,7 @@ class pdf_squille extends ModelePdfReception } } + // Qty reception $pdf->line($this->posxqtytoship - 1, $tab_top, $this->posxqtytoship - 1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxqtytoship, $tab_top + 1); @@ -792,6 +811,7 @@ class pdf_squille extends ModelePdfReception } } + // Amount if (!empty($conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT)) { $pdf->line($this->posxpuht - 1, $tab_top, $this->posxpuht - 1, $tab_top + $tab_height); if (empty($hidetop)) { diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index ce8b5bf20ce..46766e16b3f 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2319,3 +2319,5 @@ CssOnList=Css on list pages HelpCssOnEditDesc=The Css used when editing the field.
Example: "minwiwdth100 maxwidth500 widthcentpercentminusx" HelpCssOnViewDesc=The Css used when viewing the field. HelpCssOnListDesc=The Css used when field is inside a list table.
Example: "tdoverflowmax200" +RECEPTION_PDF_HIDE_ORDERED=Hide the quantity ordered on the generated documents for receptions +MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT=Show the price on the generated documents for receptions diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index dcfc3e64884..e7825407057 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -71,12 +71,6 @@ class Reception extends CommonObject public $socid; public $ref_supplier; - /** - * @var int Ref int - * @deprecated - */ - public $ref_int; - public $brouillon; public $entrepot_id; public $tracking_number; @@ -365,13 +359,10 @@ class Reception extends CommonObject * @param int $id Id of object to load * @param string $ref Ref of object * @param string $ref_ext External reference of object - * @param string $notused Internal reference of other object * @return int >0 if OK, 0 if not found, <0 if KO */ - public function fetch($id, $ref = '', $ref_ext = '', $notused = '') + public function fetch($id, $ref = '', $ref_ext = '') { - global $conf; - // Check parameters if (empty($id) && empty($ref) && empty($ref_ext)) { return -1; @@ -398,9 +389,6 @@ class Reception extends CommonObject if ($ref_ext) { $sql .= " AND e.ref_ext='".$this->db->escape($ref_ext)."'"; } - if ($notused) { - $sql .= " AND e.ref_int='".$this->db->escape($notused)."'"; - } dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); @@ -1181,7 +1169,7 @@ class Reception extends CommonObject // TODO Remove or keep this ? $line->fetch_product(); - $sql_commfourndet = 'SELECT qty, ref, label, description, tva_tx, vat_src_code, subprice, multicurrency_subprice, remise_percent'; + $sql_commfourndet = 'SELECT qty, ref, label, description, tva_tx, vat_src_code, subprice, multicurrency_subprice, remise_percent, total_ht, total_ttc, total_tva'; $sql_commfourndet .= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet'; $sql_commfourndet .= ' WHERE rowid = '.((int) $line->fk_commandefourndet); $sql_commfourndet .= ' ORDER BY rang'; @@ -1199,6 +1187,9 @@ class Reception extends CommonObject $line->remise_percent = $obj->remise_percent; $line->label = !empty($obj->label) ? $obj->label : $line->product->label; $line->ref_supplier = $obj->ref; + $line->total_ht = $obj->total_ht; + $line->total_ttc = $obj->total_ttc; + $line->total_tva = $obj->total_tva; } else { $line->qty_asked = 0; $line->description = '';