Uniformize code
This commit is contained in:
parent
b5dad8cfbf
commit
133657a8c7
@ -395,10 +395,10 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'set_ref_client' && $user->rights->facture->creer)
|
else if ($action == 'setref_client' && $user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->set_ref_client($_POST['ref_client']);
|
$object->set_ref_client(GETPOST('ref_client'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Classify to validated
|
// Classify to validated
|
||||||
@ -2878,11 +2878,61 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
// Invoice content
|
// Invoice content
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
|
||||||
|
|
||||||
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||||
|
|
||||||
|
|
||||||
|
$morehtmlref='<div class="refidno">';
|
||||||
|
// Ref customer
|
||||||
|
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', 0, 1);
|
||||||
|
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', null, null, '', 1);
|
||||||
|
// Thirdparty
|
||||||
|
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
|
||||||
|
// Project
|
||||||
|
if (! empty($conf->projet->enabled))
|
||||||
|
{
|
||||||
|
$langs->load("projects");
|
||||||
|
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||||
|
if ($user->rights->facture->creer)
|
||||||
|
{
|
||||||
|
if ($action != 'classify')
|
||||||
|
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||||
|
if ($action == 'classify') {
|
||||||
|
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||||
|
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||||
|
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||||
|
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||||
|
$morehtmlref.='<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
|
$morehtmlref.='</form>';
|
||||||
|
} else {
|
||||||
|
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (! empty($object->fk_project)) {
|
||||||
|
$proj = new Project($db);
|
||||||
|
$proj->fetch($object->fk_project);
|
||||||
|
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||||
|
$morehtmlref.=$proj->ref;
|
||||||
|
$morehtmlref.='</a>';
|
||||||
|
} else {
|
||||||
|
$morehtmlref.='';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$morehtmlref.='</div>';
|
||||||
|
|
||||||
|
$object->totalpaye = $totalpaye; // To give a change to dol_banner_tab to use already paid amount to show correct status
|
||||||
|
|
||||||
|
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
|
||||||
|
|
||||||
|
print '<div class="fichecenter">';
|
||||||
|
print '<div class="fichehalfleft">';
|
||||||
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
|
/*
|
||||||
print '<tr><td class="titlefield">' . $langs->trans('Ref') . '</td>';
|
print '<tr><td class="titlefield">' . $langs->trans('Ref') . '</td>';
|
||||||
print '<td colspan="5">';
|
print '<td colspan="5">';
|
||||||
$morehtmlright = '';
|
$morehtmlright = '';
|
||||||
@ -2946,10 +2996,10 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
print ')';
|
print ')';
|
||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';*/
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<tr><td>' . $langs->trans('Type') . '</td><td colspan="5">';
|
print '<tr><td class="titlefield">' . $langs->trans('Type') . '</td><td>';
|
||||||
print $object->getLibType();
|
print $object->getLibType();
|
||||||
if ($object->type == Facture::TYPE_REPLACEMENT) {
|
if ($object->type == Facture::TYPE_REPLACEMENT) {
|
||||||
$facreplaced = new Facture($db);
|
$facreplaced = new Facture($db);
|
||||||
@ -2990,7 +3040,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
$addcreditnote = '<a href="' . DOL_URL_ROOT . '/compta/facture.php?action=create&socid=' . $soc->id . '&type=2&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("AddCreditNote") . '</a>';
|
$addcreditnote = '<a href="' . DOL_URL_ROOT . '/compta/facture.php?action=create&socid=' . $soc->id . '&type=2&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("AddCreditNote") . '</a>';
|
||||||
|
|
||||||
print '<tr><td>' . $langs->trans('Discounts');
|
print '<tr><td>' . $langs->trans('Discounts');
|
||||||
print '</td><td colspan="5">';
|
print '</td><td>';
|
||||||
if ($soc->remise_percent)
|
if ($soc->remise_percent)
|
||||||
print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent);
|
print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent);
|
||||||
else
|
else
|
||||||
@ -3071,7 +3121,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && ! empty($object->brouillon) && $user->rights->facture->creer && empty($conf->global->FAC_FORCE_DATE_VALIDATION))
|
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && ! empty($object->brouillon) && $user->rights->facture->creer && empty($conf->global->FAC_FORCE_DATE_VALIDATION))
|
||||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editinvoicedate&facid=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
|
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editinvoicedate&facid=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td colspan="3">';
|
print '</td><td>';
|
||||||
|
|
||||||
if ($object->type != Facture::TYPE_CREDIT_NOTE) {
|
if ($object->type != Facture::TYPE_CREDIT_NOTE) {
|
||||||
if ($action == 'editinvoicedate') {
|
if ($action == 'editinvoicedate') {
|
||||||
@ -3084,18 +3134,344 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
if (! empty($conf->global->INVOICE_POINTOFTAX_DATE))
|
||||||
|
{
|
||||||
|
// Date invoice
|
||||||
|
print '<tr><td>';
|
||||||
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
|
print $langs->trans('DatePointOfTax');
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdate_pointoftax&facid=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
|
||||||
|
print '</tr></table>';
|
||||||
|
print '</td><td>';
|
||||||
|
if ($action == 'editdate_pointoftax') {
|
||||||
|
$form->form_date($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->date_pointoftax, 'date_pointoftax');
|
||||||
|
} else {
|
||||||
|
print dol_print_date($object->date_pointoftax, 'day');
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Conditions de reglement
|
||||||
|
print '<tr><td>';
|
||||||
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
|
print $langs->trans('PaymentConditionsShort');
|
||||||
|
print '</td>';
|
||||||
|
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer)
|
||||||
|
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&facid=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
|
||||||
|
print '</tr></table>';
|
||||||
|
print '</td><td>';
|
||||||
|
if ($object->type != Facture::TYPE_CREDIT_NOTE)
|
||||||
|
{
|
||||||
|
if ($action == 'editconditions') {
|
||||||
|
$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id');
|
||||||
|
} else {
|
||||||
|
$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'none');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print ' ';
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Date payment term
|
||||||
|
print '<tr><td>';
|
||||||
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
|
print $langs->trans('DateMaxPayment');
|
||||||
|
print '</td>';
|
||||||
|
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && ! empty($object->brouillon) && $user->rights->facture->creer)
|
||||||
|
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editpaymentterm&facid=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
|
||||||
|
print '</tr></table>';
|
||||||
|
print '</td><td>';
|
||||||
|
if ($object->type != Facture::TYPE_CREDIT_NOTE)
|
||||||
|
{
|
||||||
|
if ($action == 'editpaymentterm') {
|
||||||
|
$form->form_date($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->date_lim_reglement, 'paymentterm');
|
||||||
|
} else {
|
||||||
|
print dol_print_date($object->date_lim_reglement, 'day');
|
||||||
|
if ($object->hasDelay()) {
|
||||||
|
print img_warning($langs->trans('Late'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print ' ';
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Payment mode
|
||||||
|
print '<tr><td>';
|
||||||
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
|
print $langs->trans('PaymentMode');
|
||||||
|
print '</td>';
|
||||||
|
if ($action != 'editmode' && ! empty($object->brouillon) && $user->rights->facture->creer)
|
||||||
|
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&facid=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>';
|
||||||
|
print '</tr></table>';
|
||||||
|
print '</td><td>';
|
||||||
|
if ($action == 'editmode')
|
||||||
|
{
|
||||||
|
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'none', 'CRDT');
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Multicurrency
|
||||||
|
if (! empty($conf->multicurrency->enabled))
|
||||||
|
{
|
||||||
|
// Multicurrency code
|
||||||
|
print '<tr>';
|
||||||
|
print '<td>';
|
||||||
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
|
print fieldLabel('Currency','multicurrency_code');
|
||||||
|
print '</td>';
|
||||||
|
if ($action != 'editmulticurrencycode' && ! empty($object->brouillon))
|
||||||
|
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencycode&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||||
|
print '</tr></table>';
|
||||||
|
print '</td><td>';
|
||||||
|
if ($action == 'editmulticurrencycode') {
|
||||||
|
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'multicurrency_code');
|
||||||
|
} else {
|
||||||
|
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Multicurrency rate
|
||||||
|
print '<tr>';
|
||||||
|
print '<td>';
|
||||||
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
|
print fieldLabel('CurrencyRate','multicurrency_tx');
|
||||||
|
print '</td>';
|
||||||
|
if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon))
|
||||||
|
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||||
|
print '</tr></table>';
|
||||||
|
print '</td><td>';
|
||||||
|
if ($action == 'editmulticurrencyrate') {
|
||||||
|
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
|
||||||
|
} else {
|
||||||
|
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bank Account
|
||||||
|
print '<tr><td class="nowrap">';
|
||||||
|
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||||
|
print $langs->trans('BankAccount');
|
||||||
|
print '<td>';
|
||||||
|
if (($action != 'editbankaccount') && $user->rights->facture->creer && ! empty($object->brouillon))
|
||||||
|
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
|
||||||
|
print '</tr></table>';
|
||||||
|
print '</td><td>';
|
||||||
|
if ($action == 'editbankaccount')
|
||||||
|
{
|
||||||
|
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
|
||||||
|
}
|
||||||
|
print "</td>";
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Situations
|
||||||
|
if (! empty($conf->global->INVOICE_US_SITUATION))
|
||||||
|
{
|
||||||
|
if ($object->type == 5 && ($object->situation_counter > 1))
|
||||||
|
{
|
||||||
|
$prevsits = $object->get_prev_sits();
|
||||||
|
print '<tr><td>';
|
||||||
|
print $langs->trans('SituationAmount');
|
||||||
|
print ' ';
|
||||||
|
|
||||||
|
print $prevsits[0]->situation_counter;
|
||||||
|
$cprevsits = count($prevsits);
|
||||||
|
|
||||||
|
for ($i = 1; $i < $cprevsits; $i++) {
|
||||||
|
print ' + ';
|
||||||
|
print $prevsits[$i]->situation_counter;
|
||||||
|
}
|
||||||
|
print ' + ';
|
||||||
|
print $object->situation_counter;
|
||||||
|
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="right" class="nowrap">';
|
||||||
|
|
||||||
|
$prevsits_total_amount = 0;
|
||||||
|
foreach ($prevsits as $situation) {
|
||||||
|
$prevsits_total_amount += $situation->total_ht;
|
||||||
|
}
|
||||||
|
$prevsits_total_amount += $object->total_ht;
|
||||||
|
|
||||||
|
print price($prevsits_total_amount);
|
||||||
|
print '</td>';
|
||||||
|
print '<td>' . $langs->trans('Currency' . $conf->currency) . '</td></tr>';
|
||||||
|
|
||||||
|
// Previous situation(s) deduction(s)
|
||||||
|
for ($i = 0; $i < $cprevsits; $i++) {
|
||||||
|
print '<tr><td>';
|
||||||
|
print '<a href="' . $_SERVER['PHP_SELF'] . '?facid=' . $prevsits[$i]->id . '">';
|
||||||
|
print $langs->trans('SituationDeduction');
|
||||||
|
print ' ';
|
||||||
|
print $prevsits[$i]->situation_counter;
|
||||||
|
print '</a></td>';
|
||||||
|
|
||||||
|
print '<td align="right" class="nowrap">';
|
||||||
|
print '- ' . price($prevsits[$i]->total_ht);
|
||||||
|
print '</td>';
|
||||||
|
print '<td>' . $langs->trans('Currency' . $conf->currency) . '</td></tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Statut
|
||||||
|
/*
|
||||||
|
print '<tr><td>' . $langs->trans('Status') . '</td>';
|
||||||
|
print '<td colspan="3">' . ($object->getLibStatut(4, $totalpaye)) . '</td></tr>';
|
||||||
|
|
||||||
|
// Project
|
||||||
|
if (! empty($conf->projet->enabled)) {
|
||||||
|
$langs->load('projects');
|
||||||
|
print '<tr>';
|
||||||
|
print '<td>';
|
||||||
|
|
||||||
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
|
print $langs->trans('Project');
|
||||||
|
print '</td>';
|
||||||
|
if ($action != 'classify') {
|
||||||
|
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=classify&facid=' . $object->id . '">';
|
||||||
|
print img_edit($langs->trans('SetProject'), 1);
|
||||||
|
print '</a></td>';
|
||||||
|
}
|
||||||
|
print '</tr></table>';
|
||||||
|
|
||||||
|
print '</td><td colspan="3">';
|
||||||
|
if ($action == 'classify') {
|
||||||
|
$form->form_project($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1);
|
||||||
|
} else {
|
||||||
|
$form->form_project($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0);
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}*/
|
||||||
|
|
||||||
|
// Incoterms
|
||||||
|
if (!empty($conf->incoterm->enabled))
|
||||||
|
{
|
||||||
|
print '<tr><td>';
|
||||||
|
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||||
|
print $langs->trans('IncotermLabel');
|
||||||
|
print '<td><td align="right">';
|
||||||
|
if ($user->rights->facture->creer) print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||||
|
else print ' ';
|
||||||
|
print '</td></tr></table>';
|
||||||
|
print '</td>';
|
||||||
|
print '<td>';
|
||||||
|
if ($action != 'editincoterm')
|
||||||
|
{
|
||||||
|
print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Other attributes
|
||||||
|
$cols = 2;
|
||||||
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="fichehalfright">';
|
||||||
|
print '<div class="ficheaddleft">';
|
||||||
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
|
// Amount
|
||||||
|
print '<tr><td class="titlefield">' . $langs->trans('AmountHT') . '</td>';
|
||||||
|
print '<td class="nowrap">' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||||
|
print '<tr><td>' . $langs->trans('AmountVAT') . '</td><td colspan="3" class="nowrap">' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Amount Local Taxes
|
||||||
|
if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) // Localtax1
|
||||||
|
{
|
||||||
|
print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
|
||||||
|
print '<td class="nowrap">' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||||
|
}
|
||||||
|
if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) // Localtax2
|
||||||
|
{
|
||||||
|
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
|
||||||
|
print '<td class=nowrap">' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Revenue stamp
|
||||||
|
if ($selleruserevenustamp) // Test company use revenue stamp
|
||||||
|
{
|
||||||
|
print '<tr><td>';
|
||||||
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
|
print $langs->trans('RevenueStamp');
|
||||||
|
print '</td>';
|
||||||
|
if ($action != 'editrevenuestamp' && ! empty($object->brouillon) && $user->rights->facture->creer)
|
||||||
|
{
|
||||||
|
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editrevenuestamp&facid=' . $object->id . '">' . img_edit($langs->trans('SetRevenuStamp'), 1) . '</a></td>';
|
||||||
|
}
|
||||||
|
print '</tr></table>';
|
||||||
|
print '</td><td>';
|
||||||
|
if ($action == 'editrevenuestamp') {
|
||||||
|
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">';
|
||||||
|
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||||
|
print '<input type="hidden" name="action" value="setrevenuestamp">';
|
||||||
|
print $formother->select_revenue_stamp(GETPOST('revenuestamp'), 'revenuestamp', $mysoc->country_code);
|
||||||
|
// print '<input type="text" class="flat" size="4" name="revenuestamp" value="'.price2num($object->revenuestamp).'">';
|
||||||
|
print ' <input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
||||||
|
print '</form>';
|
||||||
|
} else {
|
||||||
|
print price($object->revenuestamp, 1, '', 1, - 1, - 1, $conf->currency);
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Total with tax
|
||||||
|
print '<tr><td>' . $langs->trans('AmountTTC') . '</td><td class="nowrap">' . price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||||
|
|
||||||
|
if (!empty($conf->multicurrency->enabled))
|
||||||
|
{
|
||||||
|
// Multicurrency Amount HT
|
||||||
|
print '<tr><td>' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
||||||
|
print '<td class="nowrap">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Multicurrency Amount VAT
|
||||||
|
print '<tr><td>' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
||||||
|
print '<td class="nowrap">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Multicurrency Amount TTC
|
||||||
|
print '<tr><td>' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
||||||
|
print '<td class="nowrap">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
// List of payments
|
// List of payments
|
||||||
|
|
||||||
$sign = 1;
|
$sign = 1;
|
||||||
if ($object->type == Facture::TYPE_CREDIT_NOTE)
|
if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = - 1;
|
||||||
$sign = - 1;
|
|
||||||
|
|
||||||
$nbrows = 8;
|
$nbrows = 8;
|
||||||
$nbcols = 3;
|
$nbcols = 3;
|
||||||
if (! empty($conf->projet->enabled))
|
if (! empty($conf->projet->enabled))
|
||||||
$nbrows ++;
|
$nbrows ++;
|
||||||
if (! empty($conf->banque->enabled)) {
|
if (! empty($conf->banque->enabled)) {
|
||||||
$nbrows ++; $nbcols++;
|
$nbrows ++;
|
||||||
|
$nbcols ++;
|
||||||
}
|
}
|
||||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0)
|
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0)
|
||||||
$nbrows ++;
|
$nbrows ++;
|
||||||
@ -3103,17 +3479,17 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
$nbrows ++;
|
$nbrows ++;
|
||||||
if ($selleruserevenustamp)
|
if ($selleruserevenustamp)
|
||||||
$nbrows ++;
|
$nbrows ++;
|
||||||
if (! empty($conf->multicurrency->enabled)) $nbrows+=5;
|
if (! empty($conf->multicurrency->enabled))
|
||||||
if (! empty($conf->incoterm->enabled)) $nbrows+=1;
|
$nbrows += 5;
|
||||||
|
if (! empty($conf->incoterm->enabled))
|
||||||
print '<td rowspan="' . $nbrows . '" colspan="2" valign="top">';
|
$nbrows += 1;
|
||||||
|
|
||||||
if ($object->type == Facture::TYPE_SITUATION && ! empty($conf->global->INVOICE_USE_SITUATION))
|
if ($object->type == Facture::TYPE_SITUATION && ! empty($conf->global->INVOICE_USE_SITUATION))
|
||||||
{
|
{
|
||||||
if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0) print '<table class="nobordernopadding paymenttable" width="100%">';
|
if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0)
|
||||||
|
print '<table class="nobordernopadding paymenttable" width="100%">';
|
||||||
|
|
||||||
if (count($object->tab_previous_situation_invoice) > 0)
|
if (count($object->tab_previous_situation_invoice) > 0) {
|
||||||
{
|
|
||||||
// List of previous invoices
|
// List of previous invoices
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>' . $langs->trans('ListOfPreviousSituationInvoices') . '</td>';
|
print '<td>' . $langs->trans('ListOfPreviousSituationInvoices') . '</td>';
|
||||||
@ -3127,8 +3503,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
$total_prev_ht = $total_prev_ttc = 0;
|
$total_prev_ht = $total_prev_ttc = 0;
|
||||||
$var = true;
|
$var = true;
|
||||||
foreach ($object->tab_previous_situation_invoice as $prev_invoice)
|
foreach ($object->tab_previous_situation_invoice as $prev_invoice) {
|
||||||
{
|
|
||||||
$totalpaye = $prev_invoice->getSommePaiement();
|
$totalpaye = $prev_invoice->getSommePaiement();
|
||||||
$total_prev_ht += $prev_invoice->total_ht;
|
$total_prev_ht += $prev_invoice->total_ht;
|
||||||
$total_prev_ttc += $prev_invoice->total_ttc;
|
$total_prev_ttc += $prev_invoice->total_ttc;
|
||||||
@ -3153,8 +3528,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($object->tab_next_situation_invoice) > 0)
|
if (count($object->tab_next_situation_invoice) > 0) {
|
||||||
{
|
|
||||||
// List of next invoices
|
// List of next invoices
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>' . $langs->trans('ListOfNextSituationInvoices') . '</td>';
|
print '<td>' . $langs->trans('ListOfNextSituationInvoices') . '</td>';
|
||||||
@ -3169,8 +3543,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
$total_next_ht = $total_next_ttc = 0;
|
$total_next_ht = $total_next_ttc = 0;
|
||||||
|
|
||||||
$var = true;
|
$var = true;
|
||||||
foreach ($object->tab_next_situation_invoice as $next_invoice)
|
foreach ($object->tab_next_situation_invoice as $next_invoice) {
|
||||||
{
|
|
||||||
$totalpaye = $next_invoice->getSommePaiement();
|
$totalpaye = $next_invoice->getSommePaiement();
|
||||||
$total_next_ht += $next_invoice->total_ht;
|
$total_next_ht += $next_invoice->total_ht;
|
||||||
$total_next_ttc += $next_invoice->total_ttc;
|
$total_next_ttc += $next_invoice->total_ttc;
|
||||||
@ -3195,18 +3568,20 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0) print '</table>';
|
if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0)
|
||||||
|
print '</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<table class="nobordernopadding paymenttable" width="100%">';
|
print '<table class="noborder paymenttable" width="100%">';
|
||||||
|
|
||||||
// List of payments already done
|
// List of payments already done
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre">' . ($object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')) . '</td>';
|
print '<td class="liste_titre">' . ($object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')) . '</td>';
|
||||||
print '<td class="liste_titre">' . $langs->trans('Date') . '</td>';
|
print '<td class="liste_titre">' . $langs->trans('Date') . '</td>';
|
||||||
print '<td class="liste_titre">' . $langs->trans('Type') . '</td>';
|
print '<td class="liste_titre">' . $langs->trans('Type') . '</td>';
|
||||||
if (! empty($conf->banque->enabled))
|
if (! empty($conf->banque->enabled)) {
|
||||||
print '<td class="liste_titre" align="right">' . $langs->trans('BankAccount') . '</td>';
|
print '<td class="liste_titre" align="right">' . $langs->trans('BankAccount') . '</td>';
|
||||||
|
}
|
||||||
print '<td class="liste_titre" align="right">' . $langs->trans('Amount') . '</td>';
|
print '<td class="liste_titre" align="right">' . $langs->trans('Amount') . '</td>';
|
||||||
print '<td class="liste_titre" width="18"> </td>';
|
print '<td class="liste_titre" width="18"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -3225,17 +3600,14 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
$sql .= ' ORDER BY p.datep, p.tms';
|
$sql .= ' ORDER BY p.datep, p.tms';
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result) {
|
||||||
{
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
// if ($object->type != 2)
|
// if ($object->type != 2)
|
||||||
// {
|
// {
|
||||||
if ($num > 0)
|
if ($num > 0) {
|
||||||
{
|
while ($i < $num) {
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
print '<tr ' . $bc[$var] . '><td>';
|
print '<tr ' . $bc[$var] . '><td>';
|
||||||
@ -3249,8 +3621,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
print '<td>' . dol_print_date($db->jdate($objp->dp), 'day') . '</td>';
|
print '<td>' . dol_print_date($db->jdate($objp->dp), 'day') . '</td>';
|
||||||
$label = ($langs->trans("PaymentType" . $objp->payment_code) != ("PaymentType" . $objp->payment_code)) ? $langs->trans("PaymentType" . $objp->payment_code) : $objp->payment_label;
|
$label = ($langs->trans("PaymentType" . $objp->payment_code) != ("PaymentType" . $objp->payment_code)) ? $langs->trans("PaymentType" . $objp->payment_code) : $objp->payment_label;
|
||||||
print '<td>' . $label . ' ' . $objp->num_paiement . '</td>';
|
print '<td>' . $label . ' ' . $objp->num_paiement . '</td>';
|
||||||
if (! empty($conf->banque->enabled))
|
if (! empty($conf->banque->enabled)) {
|
||||||
{
|
|
||||||
$bankaccountstatic->id = $objp->baid;
|
$bankaccountstatic->id = $objp->baid;
|
||||||
$bankaccountstatic->ref = $objp->baref;
|
$bankaccountstatic->ref = $objp->baref;
|
||||||
$bankaccountstatic->label = $objp->baref;
|
$bankaccountstatic->label = $objp->baref;
|
||||||
@ -3273,15 +3644,14 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($object->type != Facture::TYPE_CREDIT_NOTE)
|
if ($object->type != Facture::TYPE_CREDIT_NOTE) {
|
||||||
{
|
|
||||||
// Total already paid
|
// Total already paid
|
||||||
print '<tr><td colspan="' . $nbcols . '" align="right">';
|
print '<tr><td colspan="' . $nbcols . '" align="right">';
|
||||||
if ($object->type != Facture::TYPE_DEPOSIT)
|
if ($object->type != Facture::TYPE_DEPOSIT)
|
||||||
print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits');
|
print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits');
|
||||||
else
|
else
|
||||||
print $langs->trans('AlreadyPaid');
|
print $langs->trans('AlreadyPaid');
|
||||||
print ' :</td><td align="right">' . price($totalpaye) . '</td><td> </td></tr>';
|
print ' :</td><td align="right" class="amountalreadypaid">' . price($totalpaye) . '</td><td> </td></tr>';
|
||||||
|
|
||||||
$resteapayeraffiche = $resteapayer;
|
$resteapayeraffiche = $resteapayer;
|
||||||
|
|
||||||
@ -3293,13 +3663,11 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re";
|
||||||
$sql .= " WHERE fk_facture = " . $object->id;
|
$sql .= " WHERE fk_facture = " . $object->id;
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql) {
|
||||||
{
|
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$invoice = new Facture($db);
|
$invoice = new Facture($db);
|
||||||
while ($i < $num)
|
while ($i < $num) {
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
$invoice->fetch($obj->fk_facture_source);
|
$invoice->fetch($obj->fk_facture_source);
|
||||||
print '<tr><td colspan="' . $nbcols . '" align="right">';
|
print '<tr><td colspan="' . $nbcols . '" align="right">';
|
||||||
@ -3365,7 +3733,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
else
|
else
|
||||||
print $langs->trans('ExcessReceived');
|
print $langs->trans('ExcessReceived');
|
||||||
print ' :</td>';
|
print ' :</td>';
|
||||||
print '<td align="right" bgcolor="#f0f0f0"><b>' . price($resteapayeraffiche) . '</b></td>';
|
print '<td align="right" class="amountremaintopay">' . price($resteapayeraffiche) . '</td>';
|
||||||
print '<td class="nowrap"> </td></tr>';
|
print '<td class="nowrap"> </td></tr>';
|
||||||
}
|
}
|
||||||
else // Credit note
|
else // Credit note
|
||||||
@ -3397,326 +3765,16 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
// Margin Infos
|
// Margin Infos
|
||||||
if (! empty($conf->margin->enabled))
|
if (! empty($conf->margin->enabled)) {
|
||||||
{
|
$formmargin->displayMarginInfos($object);
|
||||||
print '<br>';
|
|
||||||
$formmargin->displayMarginInfos($object, $object->statut > 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
if (! empty($conf->global->INVOICE_POINTOFTAX_DATE))
|
print '</div>';
|
||||||
{
|
print '</div>';
|
||||||
// Date invoice
|
print '</div>';
|
||||||
print '<tr><td>';
|
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
|
||||||
print $langs->trans('DatePointOfTax');
|
|
||||||
print '</td>';
|
|
||||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdate_pointoftax&facid=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
|
|
||||||
print '</tr></table>';
|
|
||||||
print '</td><td colspan="3">';
|
|
||||||
if ($action == 'editdate_pointoftax') {
|
|
||||||
$form->form_date($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->date_pointoftax, 'date_pointoftax');
|
|
||||||
} else {
|
|
||||||
print dol_print_date($object->date_pointoftax, 'day');
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Conditions de reglement
|
print '<div class="clearboth"></div><br>';
|
||||||
print '<tr><td>';
|
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
|
||||||
print $langs->trans('PaymentConditionsShort');
|
|
||||||
print '</td>';
|
|
||||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer)
|
|
||||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&facid=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
|
|
||||||
print '</tr></table>';
|
|
||||||
print '</td><td colspan="3">';
|
|
||||||
if ($object->type != Facture::TYPE_CREDIT_NOTE)
|
|
||||||
{
|
|
||||||
if ($action == 'editconditions') {
|
|
||||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id');
|
|
||||||
} else {
|
|
||||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'none');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
print ' ';
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Date payment term
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
|
||||||
print $langs->trans('DateMaxPayment');
|
|
||||||
print '</td>';
|
|
||||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && ! empty($object->brouillon) && $user->rights->facture->creer)
|
|
||||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editpaymentterm&facid=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
|
|
||||||
print '</tr></table>';
|
|
||||||
print '</td><td colspan="3">';
|
|
||||||
if ($object->type != Facture::TYPE_CREDIT_NOTE)
|
|
||||||
{
|
|
||||||
if ($action == 'editpaymentterm') {
|
|
||||||
$form->form_date($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->date_lim_reglement, 'paymentterm');
|
|
||||||
} else {
|
|
||||||
print dol_print_date($object->date_lim_reglement, 'day');
|
|
||||||
if ($object->hasDelay()) {
|
|
||||||
print img_warning($langs->trans('Late'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
print ' ';
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Payment mode
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
|
||||||
print $langs->trans('PaymentMode');
|
|
||||||
print '</td>';
|
|
||||||
if ($action != 'editmode' && ! empty($object->brouillon) && $user->rights->facture->creer)
|
|
||||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&facid=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>';
|
|
||||||
print '</tr></table>';
|
|
||||||
print '</td><td colspan="3">';
|
|
||||||
if ($action == 'editmode')
|
|
||||||
{
|
|
||||||
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'none', 'CRDT');
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Multicurrency
|
|
||||||
if (! empty($conf->multicurrency->enabled))
|
|
||||||
{
|
|
||||||
// Multicurrency code
|
|
||||||
print '<tr>';
|
|
||||||
print '<td>';
|
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
|
||||||
print fieldLabel('Currency','multicurrency_code');
|
|
||||||
print '</td>';
|
|
||||||
if ($action != 'editmulticurrencycode' && ! empty($object->brouillon))
|
|
||||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencycode&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
|
||||||
print '</tr></table>';
|
|
||||||
print '</td><td colspan="3">';
|
|
||||||
if ($action == 'editmulticurrencycode') {
|
|
||||||
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'multicurrency_code');
|
|
||||||
} else {
|
|
||||||
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Multicurrency rate
|
|
||||||
print '<tr>';
|
|
||||||
print '<td>';
|
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
|
||||||
print fieldLabel('CurrencyRate','multicurrency_tx');
|
|
||||||
print '</td>';
|
|
||||||
if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon))
|
|
||||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
|
||||||
print '</tr></table>';
|
|
||||||
print '</td><td colspan="3">';
|
|
||||||
if ($action == 'editmulticurrencyrate') {
|
|
||||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
|
|
||||||
} else {
|
|
||||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bank Account
|
|
||||||
print '<tr><td class="nowrap">';
|
|
||||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
|
||||||
print $langs->trans('BankAccount');
|
|
||||||
print '<td>';
|
|
||||||
if (($action != 'editbankaccount') && $user->rights->facture->creer && ! empty($object->brouillon))
|
|
||||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
|
|
||||||
print '</tr></table>';
|
|
||||||
print '</td><td colspan="3">';
|
|
||||||
if ($action == 'editbankaccount')
|
|
||||||
{
|
|
||||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
|
|
||||||
}
|
|
||||||
print "</td>";
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
// Situations
|
|
||||||
if (! empty($conf->global->INVOICE_US_SITUATION))
|
|
||||||
{
|
|
||||||
if ($object->type == 5 && ($object->situation_counter > 1))
|
|
||||||
{
|
|
||||||
$prevsits = $object->get_prev_sits();
|
|
||||||
print '<tr><td>';
|
|
||||||
print $langs->trans('SituationAmount');
|
|
||||||
print ' ';
|
|
||||||
|
|
||||||
print $prevsits[0]->situation_counter;
|
|
||||||
$cprevsits = count($prevsits);
|
|
||||||
|
|
||||||
for ($i = 1; $i < $cprevsits; $i++) {
|
|
||||||
print ' + ';
|
|
||||||
print $prevsits[$i]->situation_counter;
|
|
||||||
}
|
|
||||||
print ' + ';
|
|
||||||
print $object->situation_counter;
|
|
||||||
|
|
||||||
print '</td>';
|
|
||||||
print '<td align="right" colspan="2" class="nowrap">';
|
|
||||||
|
|
||||||
$prevsits_total_amount = 0;
|
|
||||||
foreach ($prevsits as $situation) {
|
|
||||||
$prevsits_total_amount += $situation->total_ht;
|
|
||||||
}
|
|
||||||
$prevsits_total_amount += $object->total_ht;
|
|
||||||
|
|
||||||
print price($prevsits_total_amount);
|
|
||||||
print '</td>';
|
|
||||||
print '<td>' . $langs->trans('Currency' . $conf->currency) . '</td></tr>';
|
|
||||||
|
|
||||||
// Previous situation(s) deduction(s)
|
|
||||||
for ($i = 0; $i < $cprevsits; $i++) {
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?facid=' . $prevsits[$i]->id . '">';
|
|
||||||
print $langs->trans('SituationDeduction');
|
|
||||||
print ' ';
|
|
||||||
print $prevsits[$i]->situation_counter;
|
|
||||||
print '</a></td>';
|
|
||||||
|
|
||||||
print '<td align="right" colspan="2" class="nowrap">';
|
|
||||||
print '- ' . price($prevsits[$i]->total_ht);
|
|
||||||
print '</td>';
|
|
||||||
print '<td>' . $langs->trans('Currency' . $conf->currency) . '</td></tr>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Amount
|
|
||||||
print '<tr><td>' . $langs->trans('AmountHT') . '</td>';
|
|
||||||
print '<td colspan="3" class="nowrap">' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
|
||||||
print '<tr><td>' . $langs->trans('AmountVAT') . '</td><td colspan="3" class="nowrap">' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
// Amount Local Taxes
|
|
||||||
if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) // Localtax1
|
|
||||||
{
|
|
||||||
print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
|
|
||||||
print '<td colspan="3" class="nowrap">' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
|
||||||
}
|
|
||||||
if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) // Localtax2
|
|
||||||
{
|
|
||||||
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
|
|
||||||
print '<td colspan="3" class=nowrap">' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Revenue stamp
|
|
||||||
if ($selleruserevenustamp) // Test company use revenue stamp
|
|
||||||
{
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
|
||||||
print $langs->trans('RevenueStamp');
|
|
||||||
print '</td>';
|
|
||||||
if ($action != 'editrevenuestamp' && ! empty($object->brouillon) && $user->rights->facture->creer)
|
|
||||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editrevenuestamp&facid=' . $object->id . '">' . img_edit($langs->trans('SetRevenuStamp'), 1) . '</a></td>';
|
|
||||||
print '</tr></table>';
|
|
||||||
print '</td><td colspan="3">';
|
|
||||||
if ($action == 'editrevenuestamp') {
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">';
|
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
|
||||||
print '<input type="hidden" name="action" value="setrevenuestamp">';
|
|
||||||
print $formother->select_revenue_stamp(GETPOST('revenuestamp'), 'revenuestamp', $mysoc->country_code);
|
|
||||||
// print '<input type="text" class="flat" size="4" name="revenuestamp" value="'.price2num($object->revenuestamp).'">';
|
|
||||||
print ' <input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
|
||||||
print '</form>';
|
|
||||||
} else {
|
|
||||||
print price($object->revenuestamp, 1, '', 1, - 1, - 1, $conf->currency);
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Total with tax
|
|
||||||
print '<tr><td>' . $langs->trans('AmountTTC') . '</td><td colspan="3" class="nowrap">' . price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
|
||||||
|
|
||||||
if (!empty($conf->multicurrency->enabled))
|
|
||||||
{
|
|
||||||
// Multicurrency Amount HT
|
|
||||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
|
||||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
// Multicurrency Amount VAT
|
|
||||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
|
||||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
// Multicurrency Amount TTC
|
|
||||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
|
||||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Statut
|
|
||||||
print '<tr><td>' . $langs->trans('Status') . '</td>';
|
|
||||||
print '<td colspan="3">' . ($object->getLibStatut(4, $totalpaye)) . '</td></tr>';
|
|
||||||
|
|
||||||
// Project
|
|
||||||
if (! empty($conf->projet->enabled)) {
|
|
||||||
$langs->load('projects');
|
|
||||||
print '<tr>';
|
|
||||||
print '<td>';
|
|
||||||
|
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
|
||||||
print $langs->trans('Project');
|
|
||||||
print '</td>';
|
|
||||||
if ($action != 'classify') {
|
|
||||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=classify&facid=' . $object->id . '">';
|
|
||||||
print img_edit($langs->trans('SetProject'), 1);
|
|
||||||
print '</a></td>';
|
|
||||||
}
|
|
||||||
print '</tr></table>';
|
|
||||||
|
|
||||||
print '</td><td colspan="3">';
|
|
||||||
if ($action == 'classify') {
|
|
||||||
$form->form_project($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1);
|
|
||||||
} else {
|
|
||||||
$form->form_project($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0);
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Incoterms
|
|
||||||
if (!empty($conf->incoterm->enabled))
|
|
||||||
{
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
|
||||||
print $langs->trans('IncotermLabel');
|
|
||||||
print '<td><td align="right">';
|
|
||||||
if ($user->rights->facture->creer) print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
|
||||||
else print ' ';
|
|
||||||
print '</td></tr></table>';
|
|
||||||
print '</td>';
|
|
||||||
print '<td colspan="3">';
|
|
||||||
if ($action != 'editincoterm')
|
|
||||||
{
|
|
||||||
print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id);
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Other attributes
|
|
||||||
$cols = 5;
|
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
|
||||||
|
|
||||||
print '</table><br>';
|
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
|
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
|
||||||
$blocname = 'contacts';
|
$blocname = 'contacts';
|
||||||
|
|||||||
@ -1516,6 +1516,8 @@ class Facture extends CommonInvoice
|
|||||||
*/
|
*/
|
||||||
function set_ref_client($ref_client, $notrigger=0)
|
function set_ref_client($ref_client, $notrigger=0)
|
||||||
{
|
{
|
||||||
|
global $user;
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|||||||
@ -209,7 +209,7 @@ class FormMargin
|
|||||||
if (!empty($hidemargininfos)) print '<script>$(document).ready(function() {$(".margininfos").hide();});</script>';
|
if (!empty($hidemargininfos)) print '<script>$(document).ready(function() {$(".margininfos").hide();});</script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<table class="border margintable" width="100%">';
|
print '<table class="noborder margintable centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre">'.$langs->trans('Margins').'</td>';
|
print '<td class="liste_titre">'.$langs->trans('Margins').'</td>';
|
||||||
print '<td class="liste_titre" align="right">'.$langs->trans('SellingPrice').'</td>';
|
print '<td class="liste_titre" align="right">'.$langs->trans('SellingPrice').'</td>';
|
||||||
|
|||||||
@ -986,6 +986,12 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
|||||||
$morehtmlright.=$object->getLibStatut(5,1);
|
$morehtmlright.=$object->getLibStatut(5,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elseif ($object->element == 'facture')
|
||||||
|
{
|
||||||
|
$tmptxt=$object->getLibStatut(6, $object->totalpaye);
|
||||||
|
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) $tmptxt=$object->getLibStatut(5, $object->totalpaye);
|
||||||
|
$morehtmlright.=$tmptxt;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
$tmptxt=$object->getLibStatut(6);
|
$tmptxt=$object->getLibStatut(6);
|
||||||
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) $tmptxt=$object->getLibStatut(5);
|
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) $tmptxt=$object->getLibStatut(5);
|
||||||
|
|||||||
@ -209,7 +209,7 @@ function showPaypalPaymentUrl($type,$ref)
|
|||||||
$out='<br><br>';
|
$out='<br><br>';
|
||||||
$out.=img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'<br>';
|
$out.=img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'<br>';
|
||||||
$url=getPaypalPaymentUrl(0,$type,$ref);
|
$url=getPaypalPaymentUrl(0,$type,$ref);
|
||||||
$out.='<input type="text" id="paypalurl" value="'.$url.'" size="60"><br>';
|
$out.='<input type="text" id="paypalurl" class="quatrevingtpercent" value="'.$url.'"><br>';
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -580,6 +580,14 @@ div.myavailability {
|
|||||||
.tablelistofcalendars {
|
.tablelistofcalendars {
|
||||||
margin-top: 25px !important;
|
margin-top: 25px !important;
|
||||||
}
|
}
|
||||||
|
.amountalreadypaid {
|
||||||
|
color: #008800;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.amountremaintopay {
|
||||||
|
color: #880000;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
/* DOL_XXX for future usage (when left menu has been removed). If we do not use datatable */
|
/* DOL_XXX for future usage (when left menu has been removed). If we do not use datatable */
|
||||||
.table-responsive {
|
.table-responsive {
|
||||||
@ -2833,6 +2841,7 @@ tr.liste_sub_total, tr.liste_sub_total td {
|
|||||||
border-top-width: <?php echo $borderwith ?>px !important;
|
border-top-width: <?php echo $borderwith ?>px !important;
|
||||||
border-top-color: rgb(<?php echo $colortopbordertitle1 ?>) !important;
|
border-top-color: rgb(<?php echo $colortopbordertitle1 ?>) !important;
|
||||||
border-top-style: solid !important;
|
border-top-style: solid !important;
|
||||||
|
margin: 0px 0px 0px 0px !important;
|
||||||
}
|
}
|
||||||
.paymenttable tr td:first-child, .margintable tr td:first-child
|
.paymenttable tr td:first-child, .margintable tr td:first-child
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user