Merge pull request #5825 from aspangaro/5.0-p20
Work on supplier type (Replacement / deposit / credit note) invoice
This commit is contained in:
commit
e17eea5ea5
@ -177,6 +177,11 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
*/
|
*/
|
||||||
const STATUS_ABANDONED = 3;
|
const STATUS_ABANDONED = 3;
|
||||||
|
|
||||||
|
const CLOSECODE_DISCOUNTVAT = 'discount_vat';
|
||||||
|
const CLOSECODE_BADCREDIT = 'badsupplier';
|
||||||
|
const CLOSECODE_ABANDONED = 'abandon';
|
||||||
|
const CLOSECODE_REPLACED = 'replaced';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
|
|||||||
@ -6,8 +6,9 @@
|
|||||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2013-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2013-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
|
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -55,12 +56,15 @@ $langs->load('banks');
|
|||||||
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
|
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
|
||||||
|
|
||||||
$id = (GETPOST('facid','int') ? GETPOST('facid','int') : GETPOST('id','int'));
|
$id = (GETPOST('facid','int') ? GETPOST('facid','int') : GETPOST('id','int'));
|
||||||
|
$socid = GETPOST('socid', 'int');
|
||||||
$action = GETPOST("action");
|
$action = GETPOST("action");
|
||||||
$confirm = GETPOST("confirm");
|
$confirm = GETPOST("confirm");
|
||||||
$ref = GETPOST('ref','alpha');
|
$ref = GETPOST('ref','alpha');
|
||||||
$cancel = GETPOST('cancel','alpha');
|
$cancel = GETPOST('cancel','alpha');
|
||||||
$lineid = GETPOST('lineid', 'int');
|
$lineid = GETPOST('lineid', 'int');
|
||||||
$projectid = GETPOST('projectid','int');
|
$projectid = GETPOST('projectid','int');
|
||||||
|
$origin = GETPOST('origin', 'alpha');
|
||||||
|
$originid = GETPOST('origin', 'int');
|
||||||
|
|
||||||
//PDF
|
//PDF
|
||||||
$hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
$hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
||||||
@ -1153,22 +1157,22 @@ if ($action == 'create')
|
|||||||
|
|
||||||
$currency_code = $conf->currency;
|
$currency_code = $conf->currency;
|
||||||
|
|
||||||
$societe='';
|
$societe='';
|
||||||
if (GETPOST('socid') > 0)
|
if (GETPOST('socid') > 0)
|
||||||
{
|
{
|
||||||
$societe=new Societe($db);
|
$societe=new Societe($db);
|
||||||
$societe->fetch(GETPOST('socid','int'));
|
$societe->fetch(GETPOST('socid','int'));
|
||||||
if (!empty($conf->multicurrency->enabled) && !empty($societe->multicurrency_code)) $currency_code = $societe->multicurrency_code;
|
if (!empty($conf->multicurrency->enabled) && !empty($societe->multicurrency_code)) $currency_code = $societe->multicurrency_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST('origin') && GETPOST('originid'))
|
if (! empty($origin) && ! empty($originid))
|
||||||
{
|
{
|
||||||
// Parse element/subelement (ex: project_task)
|
// Parse element/subelement (ex: project_task)
|
||||||
$element = $subelement = GETPOST('origin');
|
$element = $subelement = $origin;
|
||||||
|
|
||||||
if ($element == 'project')
|
if ($element == 'project')
|
||||||
{
|
{
|
||||||
$projectid=GETPOST('originid');
|
$projectid = $originid;
|
||||||
$element = 'projet';
|
$element = 'projet';
|
||||||
}
|
}
|
||||||
else if (in_array($element,array('order_supplier')))
|
else if (in_array($element,array('order_supplier')))
|
||||||
@ -1191,7 +1195,7 @@ if ($action == 'create')
|
|||||||
$classname = ucfirst($subelement);
|
$classname = ucfirst($subelement);
|
||||||
if ($classname == 'Fournisseur.commande') $classname='CommandeFournisseur';
|
if ($classname == 'Fournisseur.commande') $classname='CommandeFournisseur';
|
||||||
$objectsrc = new $classname($db);
|
$objectsrc = new $classname($db);
|
||||||
$objectsrc->fetch(GETPOST('originid'));
|
$objectsrc->fetch($originid);
|
||||||
$objectsrc->fetch_thirdparty();
|
$objectsrc->fetch_thirdparty();
|
||||||
|
|
||||||
$projectid = (!empty($objectsrc->fk_project)?$objectsrc->fk_project:'');
|
$projectid = (!empty($objectsrc->fk_project)?$objectsrc->fk_project:'');
|
||||||
@ -1230,12 +1234,12 @@ if ($action == 'create')
|
|||||||
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
|
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
print '<input type="hidden" name="origin" value="'.GETPOST('origin').'">';
|
if ($societe->id > 0) print '<input type="hidden" name="socid" value="' . $societe->id . '">' . "\n";
|
||||||
print '<input type="hidden" name="originid" value="'.GETPOST('originid').'">';
|
print '<input type="hidden" name="origin" value="'.$origin.'">';
|
||||||
|
print '<input type="hidden" name="originid" value="'.$originid.'">';
|
||||||
if (!empty($currency_tx)) print '<input type="hidden" name="originmulticurrency_tx" value="' . $currency_tx . '">';
|
if (!empty($currency_tx)) print '<input type="hidden" name="originmulticurrency_tx" value="' . $currency_tx . '">';
|
||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
@ -1249,14 +1253,14 @@ if ($action == 'create')
|
|||||||
print '<tr><td class="fieldrequired">'.$langs->trans('Supplier').'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans('Supplier').'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
|
|
||||||
if (GETPOST('socid') > 0)
|
if ($societe->id > 0)
|
||||||
{
|
{
|
||||||
print $societe->getNomUrl(1);
|
print $societe->getNomUrl(1);
|
||||||
print '<input type="hidden" name="socid" value="'.GETPOST('socid','int').'">';
|
print '<input type="hidden" name="socid" value="'.$societe->id.'">';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $form->select_company(GETPOST('socid','int'), 'socid', 's.fournisseur = 1', 'SelectThirdParty');
|
print $form->select_company($societe->id, 'socid', 's.fournisseur = 1', 'SelectThirdParty');
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -1264,84 +1268,223 @@ if ($action == 'create')
|
|||||||
print '<tr><td class="fieldrequired">'.$langs->trans('RefSupplier').'</td><td><input name="ref_supplier" value="'.(isset($_POST['ref_supplier'])?$_POST['ref_supplier']:'').'" type="text"></td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans('RefSupplier').'</td><td><input name="ref_supplier" value="'.(isset($_POST['ref_supplier'])?$_POST['ref_supplier']:'').'" type="text"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Type
|
// Type invoice
|
||||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans('Type').'</td><td colspan="2">';
|
$facids = $facturestatic->list_replacable_supplier_invoices($societe->id);
|
||||||
print '<table class="nobordernopadding">'."\n";
|
if ($facids < 0) {
|
||||||
// Standard invoice
|
dol_print_error($db, $facturestatic);
|
||||||
print '<tr height="18"><td width="16px" valign="middle">';
|
exit();
|
||||||
print '<input type="radio" name="type" value="0"'.($_POST['type']==0?' checked':'').'>';
|
}
|
||||||
print '</td><td valign="middle">';
|
$options = "";
|
||||||
$desc=$form->textwithpicto($langs->trans("InvoiceStandardAsk"),$langs->transnoentities("InvoiceStandardDesc"),1);
|
foreach ($facids as $facparam)
|
||||||
print $desc;
|
{
|
||||||
print '</td></tr>'."\n";
|
$options .= '<option value="' . $facparam ['id'] . '"';
|
||||||
/*
|
if ($facparam ['id'] == $_POST['fac_replacement'])
|
||||||
// Deposit
|
$options .= ' selected';
|
||||||
print '<tr height="18"><td width="16px" valign="middle">';
|
$options .= '>' . $facparam ['ref'];
|
||||||
print '<input type="radio" name="type" value="3"'.($_POST['type']==3?' checked':'').'>';
|
$options .= ' (' . $facturestatic->LibStatut(0, $facparam ['status']) . ')';
|
||||||
print '</td><td valign="middle">';
|
$options .= '</option>';
|
||||||
$desc=$form->textwithpicto($langs->trans("InvoiceDeposit"),$langs->transnoentities("InvoiceDepositDesc"),1);
|
}
|
||||||
print $desc;
|
|
||||||
print '</td></tr>'."\n";
|
// Show link for credit note
|
||||||
// Proforma
|
$facids=$facturestatic->list_qualified_avoir_supplier_invoices($societe->id);
|
||||||
if (! empty($conf->global->FACTURE_USE_PROFORMAT))
|
if ($facids < 0)
|
||||||
{
|
{
|
||||||
print '<tr height="18"><td width="16px" valign="middle">';
|
dol_print_error($db,$facturestatic);
|
||||||
print '<input type="radio" name="type" value="4"'.($_POST['type']==4?' checked':'').'>';
|
exit;
|
||||||
print '</td><td valign="middle">';
|
}
|
||||||
$desc=$form->textwithpicto($langs->trans("InvoiceProForma"),$langs->transnoentities("InvoiceProFormaDesc"),1);
|
$optionsav = "";
|
||||||
print $desc;
|
$newinvoice_static = new FactureFournisseur($db);
|
||||||
print '</td></tr>'."\n";
|
foreach ($facids as $key => $valarray)
|
||||||
}
|
{
|
||||||
// Replacement
|
$newinvoice_static->id = $key;
|
||||||
print '<tr height="18"><td valign="middle">';
|
$newinvoice_static->ref = $valarray ['ref'];
|
||||||
print '<input type="radio" name="type" value="1"'.($_POST['type']==1?' checked':'');
|
$newinvoice_static->statut = $valarray ['status'];
|
||||||
if (! $options) print ' disabled';
|
$newinvoice_static->type = $valarray ['type'];
|
||||||
print '>';
|
$newinvoice_static->paye = $valarray ['paye'];
|
||||||
print '</td><td valign="middle">';
|
|
||||||
$text=$langs->trans("InvoiceReplacementAsk").' ';
|
$optionsav .= '<option value="' . $key . '"';
|
||||||
$text.='<select class="flat" name="fac_replacement"';
|
if ($key == GETPOST('fac_avoir','int'))
|
||||||
if (! $options) $text.=' disabled';
|
$optionsav .= ' selected';
|
||||||
$text.='>';
|
$optionsav .= '>';
|
||||||
if ($options)
|
$optionsav .= $newinvoice_static->ref;
|
||||||
{
|
$optionsav .= ' (' . $newinvoice_static->getLibStatut(1, $valarray ['paymentornot']) . ')';
|
||||||
$text.='<option value="-1"> </option>';
|
$optionsav .= '</option>';
|
||||||
$text.=$options;
|
}
|
||||||
}
|
|
||||||
else
|
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans('Type').'</td><td colspan="2">';
|
||||||
{
|
|
||||||
$text.='<option value="-1">'.$langs->trans("NoReplacableInvoice").'</option>';
|
print '<div class="tagtable">' . "\n";
|
||||||
}
|
|
||||||
$text.='</select>';
|
// Standard invoice
|
||||||
$desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceReplacementDesc"),1);
|
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||||
print $desc;
|
$tmp='<input type="radio" id="radio_standard" name="type" value="0"' . (GETPOST('type') == 0 ? ' checked' : '') . '> ';
|
||||||
print '</td></tr>';
|
$desc = $form->textwithpicto($tmp.$langs->trans("InvoiceStandardAsk"), $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3);
|
||||||
// Credit note
|
print $desc;
|
||||||
print '<tr height="18"><td valign="middle">';
|
print '</div></div>';
|
||||||
print '<input type="radio" name="type" value="2"'.($_POST['type']==2?' checked':'');
|
|
||||||
if (! $optionsav) print ' disabled';
|
if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid))))
|
||||||
print '>';
|
{
|
||||||
print '</td><td valign="middle">';
|
// Deposit
|
||||||
$text=$langs->transnoentities("InvoiceAvoirAsk").' ';
|
if (empty($conf->global->INVOICE_DISABLE_DEPOSIT))
|
||||||
// $text.='<input type="text" value="">';
|
{
|
||||||
$text.='<select class="flat" name="fac_avoir"';
|
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||||
if (! $optionsav) $text.=' disabled';
|
$tmp='<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOST('type') == 3 ? ' checked' : '') . '> ';
|
||||||
$text.='>';
|
print '<script type="text/javascript" language="javascript">
|
||||||
if ($optionsav)
|
jQuery(document).ready(function() {
|
||||||
{
|
jQuery("#typedeposit, #valuedeposit").click(function() {
|
||||||
$text.='<option value="-1"> </option>';
|
jQuery("#radio_deposit").prop("checked", true);
|
||||||
$text.=$optionsav;
|
});
|
||||||
}
|
});
|
||||||
else
|
</script>';
|
||||||
{
|
|
||||||
$text.='<option value="-1">'.$langs->trans("NoInvoiceToCorrect").'</option>';
|
$desc = $form->textwithpicto($tmp.$langs->trans("InvoiceDeposit"), $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3);
|
||||||
}
|
print '<table class="nobordernopadding"><tr><td>';
|
||||||
$text.='</select>';
|
print $desc;
|
||||||
$desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceAvoirDesc"),1);
|
print '</td>';
|
||||||
print $desc;
|
if (($origin == 'propal') || ($origin == 'commande'))
|
||||||
print '</td></tr>'."\n";
|
{
|
||||||
*/
|
print '<td class="nowrap" style="padding-left: 5px">';
|
||||||
print '</table>';
|
$arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount');
|
||||||
print '</td></tr>';
|
print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1);
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="nowrap" style="padding-left: 5px">' . $langs->trans('Value') . ':<input type="text" id="valuedeposit" name="valuedeposit" size="3" value="' . GETPOST('valuedeposit', 'int') . '"/>';
|
||||||
|
}
|
||||||
|
print '</td></tr></table>';
|
||||||
|
|
||||||
|
print '</div></div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($societe->id > 0)
|
||||||
|
{
|
||||||
|
// Replacement
|
||||||
|
if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT))
|
||||||
|
{
|
||||||
|
print '<!-- replacement line -->';
|
||||||
|
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||||
|
$tmp='<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked' : '');
|
||||||
|
if (! $options) $tmp.=' disabled';
|
||||||
|
$tmp.='> ';
|
||||||
|
print '<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function() {
|
||||||
|
jQuery("#fac_replacement").change(function() {
|
||||||
|
jQuery("#radio_replacement").prop("checked", true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
$text = $tmp.$langs->trans("InvoiceReplacementAsk") . ' ';
|
||||||
|
$text .= '<select class="flat" name="fac_replacement" id="fac_replacement"';
|
||||||
|
if (! $options)
|
||||||
|
$text .= ' disabled';
|
||||||
|
$text .= '>';
|
||||||
|
if ($options) {
|
||||||
|
$text .= '<option value="-1"> </option>';
|
||||||
|
$text .= $options;
|
||||||
|
} else {
|
||||||
|
$text .= '<option value="-1">' . $langs->trans("NoReplacableInvoice") . '</option>';
|
||||||
|
}
|
||||||
|
$text .= '</select>';
|
||||||
|
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3);
|
||||||
|
print $desc;
|
||||||
|
print '</div></div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||||
|
$tmp='<input type="radio" name="type" id="radio_replacement" value="0" disabled> ';
|
||||||
|
$text = $tmp.$langs->trans("InvoiceReplacement") . ' ';
|
||||||
|
$text.= '('.$langs->trans("YouMustCreateInvoiceFromSupplierThird").') ';
|
||||||
|
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3);
|
||||||
|
print $desc;
|
||||||
|
print '</div></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($origin))
|
||||||
|
{
|
||||||
|
if ($societe->id > 0)
|
||||||
|
{
|
||||||
|
// Credit note
|
||||||
|
if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE))
|
||||||
|
{
|
||||||
|
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||||
|
$tmp='<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : '');
|
||||||
|
if (! $optionsav) $tmp.=' disabled';
|
||||||
|
$tmp.= '> ';
|
||||||
|
// Show credit note options only if we checked credit note
|
||||||
|
print '<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function() {
|
||||||
|
if (! jQuery("#radio_creditnote").is(":checked"))
|
||||||
|
{
|
||||||
|
jQuery("#credit_note_options").hide();
|
||||||
|
}
|
||||||
|
jQuery("#radio_creditnote").click(function() {
|
||||||
|
jQuery("#credit_note_options").show();
|
||||||
|
});
|
||||||
|
jQuery("#radio_standard, #radio_replacement, #radio_deposit").click(function() {
|
||||||
|
jQuery("#credit_note_options").hide();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
$text = $tmp.$langs->transnoentities("InvoiceAvoirAsk") . ' ';
|
||||||
|
// $text.='<input type="text" value="">';
|
||||||
|
$text .= '<select class="flat" name="fac_avoir" id="fac_avoir"';
|
||||||
|
if (! $optionsav)
|
||||||
|
$text .= ' disabled';
|
||||||
|
$text .= '>';
|
||||||
|
if ($optionsav) {
|
||||||
|
$text .= '<option value="-1"></option>';
|
||||||
|
$text .= $optionsav;
|
||||||
|
} else {
|
||||||
|
$text .= '<option value="-1">' . $langs->trans("NoInvoiceToCorrect") . '</option>';
|
||||||
|
}
|
||||||
|
$text .= '</select>';
|
||||||
|
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3);
|
||||||
|
print $desc;
|
||||||
|
|
||||||
|
print '<div id="credit_note_options" class="clearboth">';
|
||||||
|
print ' <input data-role="none" type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithPaymentRestAmount\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithLines','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>";
|
||||||
|
print '<br> <input data-role="none" type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithLines\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '</div></div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||||
|
$tmp='<input type="radio" name="type" id="radio_creditnote" value="0" disabled> ';
|
||||||
|
$text = $tmp.$langs->trans("InvoiceAvoir") . ' ';
|
||||||
|
$text.= '('.$langs->trans("YouMustCreateInvoiceFromSupplierThird").') ';
|
||||||
|
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3);
|
||||||
|
print $desc;
|
||||||
|
print '</div></div>' . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
if ($socid > 0)
|
||||||
|
{
|
||||||
|
// Discounts for third party
|
||||||
|
print '<tr><td>' . $langs->trans('Discounts') . '</td><td colspan="2">';
|
||||||
|
if ($soc->remise_percent)
|
||||||
|
print $langs->trans("CompanyHasRelativeDiscount", '<a href="' . DOL_URL_ROOT . '/comm/remise.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?socid=' . $soc->id . '&action=' . $action . '&origin=' . GETPOST('origin') . '&originid=' . GETPOST('originid')) . '">' . $soc->remise_percent . '</a>');
|
||||||
|
else
|
||||||
|
print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||||
|
print ' <a href="' . DOL_URL_ROOT . '/comm/remise.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?socid=' . $soc->id . '&action=' . $action . '&origin=' . GETPOST('origin') . '&originid=' . GETPOST('originid')) . '">(' . $langs->trans("EditRelativeDiscount") . ')</a>';
|
||||||
|
print '. ';
|
||||||
|
print '<br>';
|
||||||
|
if ($absolute_discount)
|
||||||
|
print $langs->trans("CompanyHasAbsoluteDiscount", '<a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?socid=' . $soc->id . '&action=' . $action . '&origin=' . GETPOST('origin') . '&originid=' . GETPOST('originid')) . '">' . price($absolute_discount) . '</a>', $langs->trans("Currency" . $conf->currency));
|
||||||
|
else
|
||||||
|
print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||||
|
print ' <a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?socid=' . $soc->id . '&action=' . $action . '&origin=' . GETPOST('origin') . '&originid=' . GETPOST('originid')) . '">(' . $langs->trans("EditGlobalDiscounts") . ')</a>';
|
||||||
|
print '.';
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print '<tr><td>'.$langs->trans('Label').'</td><td><input size="30" name="label" value="'.dol_escape_htmltag(GETPOST('label')).'" type="text"></td></tr>';
|
print '<tr><td>'.$langs->trans('Label').'</td><td><input size="30" name="label" value="'.dol_escape_htmltag(GETPOST('label')).'" type="text"></td></tr>';
|
||||||
@ -1535,7 +1678,7 @@ else
|
|||||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
|
||||||
$alreadypaid=$object->getSommePaiement();
|
$alreadypaid=$object->getSommePaiement();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View card
|
* View card
|
||||||
*/
|
*/
|
||||||
@ -1646,9 +1789,8 @@ else
|
|||||||
|
|
||||||
|
|
||||||
// Supplier invoice card
|
// Supplier invoice card
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
$morehtmlref='<div class="refidno">';
|
$morehtmlref='<div class="refidno">';
|
||||||
// Ref supplier
|
// Ref supplier
|
||||||
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1);
|
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1);
|
||||||
@ -1688,18 +1830,16 @@ else
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$morehtmlref.='</div>';
|
$morehtmlref.='</div>';
|
||||||
|
|
||||||
$object->totalpaye = $alreadypaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
$object->totalpaye = $alreadypaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||||
|
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
print '<div class="fichehalfleft">';
|
print '<div class="fichehalfleft">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
/*
|
/*
|
||||||
@ -1718,7 +1858,7 @@ else
|
|||||||
print ' (<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?socid='.$object->socid.'">'.$langs->trans('OtherBills').'</a>)</td>';
|
print ' (<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?socid='.$object->socid.'">'.$langs->trans('OtherBills').'</a>)</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<tr><td class="titlefield">'.$langs->trans('Type').'</td><td>';
|
print '<tr><td class="titlefield">'.$langs->trans('Type').'</td><td>';
|
||||||
print $object->getLibType();
|
print $object->getLibType();
|
||||||
@ -2263,6 +2403,15 @@ else
|
|||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=clone&socid='.$object->socid.'">'.$langs->trans('ToClone').'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=clone&socid='.$object->socid.'">'.$langs->trans('ToClone').'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create a credit note
|
||||||
|
if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_DEPOSIT) && $object->statut > 0 && $user->rights->fournisseur->facture->creer)
|
||||||
|
{
|
||||||
|
if (! $objectidnext)
|
||||||
|
{
|
||||||
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?socid=' . $object->socid .'&fac_avoir=' . $object->id . '&action=create&type=2'.($object->fk_project > 0 ? '&projectid='.$object->fk_project : '').'">' . $langs->trans("CreateCreditNote") . '</a></div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
if ($action != 'edit' && $user->rights->fournisseur->facture->supprimer)
|
if ($action != 'edit' && $user->rights->fournisseur->facture->supprimer)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -438,6 +438,7 @@ ListOfYourUnpaidInvoices=List of unpaid invoices
|
|||||||
NoteListOfYourUnpaidInvoices=Note: This list contains only invoices for third parties you are linked to as a sale representative.
|
NoteListOfYourUnpaidInvoices=Note: This list contains only invoices for third parties you are linked to as a sale representative.
|
||||||
RevenueStamp=Revenue stamp
|
RevenueStamp=Revenue stamp
|
||||||
YouMustCreateInvoiceFromThird=This option is only available when creating invoice from tab "customer" of thirdparty
|
YouMustCreateInvoiceFromThird=This option is only available when creating invoice from tab "customer" of thirdparty
|
||||||
|
YouMustCreateInvoiceFromSupplierThird=This option is only available when creating invoice from tab "supplier" of thirdparty
|
||||||
YouMustCreateStandardInvoiceFirstDesc=You have to create a standard invoice first and convert it to "template" to create a new template invoice
|
YouMustCreateStandardInvoiceFirstDesc=You have to create a standard invoice first and convert it to "template" to create a new template invoice
|
||||||
PDFCrabeDescription=Invoice PDF template Crabe. A complete invoice template (recommended Template)
|
PDFCrabeDescription=Invoice PDF template Crabe. A complete invoice template (recommended Template)
|
||||||
PDFCrevetteDescription=Invoice PDF template Crevette. A complete invoice template for situation invoices
|
PDFCrevetteDescription=Invoice PDF template Crevette. A complete invoice template for situation invoices
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user