$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice } else { $filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')"; $filtercreditnote = "fk_facture_source IS NOT NULL AND description <> '(DEPOSIT)'"; } $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount); $absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote); $absolute_discount = price2num($absolute_discount, 'MT'); $absolute_creditnote = price2num($absolute_creditnote, 'MT'); $author = new User($db); if ($object->user_author) { $author->fetch($object->user_author); } $objectidnext = $object->getIdReplacingInvoice(); $head = facture_prepare_head($object); dol_fiche_head($head, 'compta', $langs->trans('InvoiceCustomer'), 0, 'bill'); $formconfirm = ''; // Confirmation de la conversion de l'avoir en reduc if ($action == 'converttoreduc') { $text = $langs->trans('ConfirmConvertToReduc'); $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('ConvertToReduc'), $text, 'confirm_converttoreduc', '', "yes", 2); } // Confirmation to delete invoice if ($action == 'delete') { $text = $langs->trans('ConfirmDeleteBill', $object->ref); $formquestion = array(); $qualified_for_stock_change = 0; if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $qualified_for_stock_change = $object->hasProductsOrServices(2); } else {
if ($fac->paye) $resteapayer=0; $resteapayeraffiche=$resteapayer; $absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL'); $absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL'); $absolute_discount=price2num($absolute_discount,'MT'); $absolute_creditnote=price2num($absolute_creditnote,'MT'); $author = new User($db); if ($fac->user_author) { $author->fetch($fac->user_author); } $head = facture_prepare_head($fac); dol_fiche_head($head, 'standingorders', $langs->trans('InvoiceCustomer'),0,'bill'); /* * Facture */ print '<table class="border" width="100%">'; // Ref print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="5">'; $morehtmlref=''; $discount=new DiscountAbsolute($db); $result=$discount->fetch(0,$fac->id); if ($result > 0) {