';
+ // Ref
+ print '| '.$langs->trans("Ref").' | ';
+ $morehtmlref='';
+ $discount=new DiscountAbsolute($db);
+ $result=$discount->fetch(0,$object->id);
+ if ($result > 0)
+ {
+ $morehtmlref=' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')';
+ }
+ if ($result < 0)
+ {
+ dol_print_error('',$discount->error);
+ }
+ print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref);
+ print " |
";
- $linkback = ''.$langs->trans("BackToList").'';
+ // Ref customer
+ print '';
+ print '| ';
+ print $langs->trans('RefCustomer');
+ print ' | ';
+ print ' ';
+ print ' | ';
+ print '';
+ print $object->ref_client;
+ print ' |
';
- // Ref
- print '| '.$langs->trans("Ref").' | ';
- $morehtmlref='';
- $discount=new DiscountAbsolute($db);
- $result=$discount->fetch(0,$object->id);
- if ($result > 0)
- {
- $morehtmlref=' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')';
- }
- if ($result < 0)
- {
- dol_print_error('',$discount->error);
- }
- print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref);
- print " |
";
+ // Third party
+ print '| '.$langs->trans('Company').' | ';
+ print ''.$object->thirdparty->getNomUrl(1,'compta');
+ print ' ('.$langs->trans('OtherBills').') | ';
+ print '
';
- // Ref customer
- print '';
- print '| ';
- print $langs->trans('RefCustomer');
- print ' | ';
- print ' ';
- print ' | ';
- print '';
- print $object->ref_client;
- print ' |
';
+ // Type
+ print '| '.$langs->trans('Type').' | ';
+ print $object->getLibType();
+ if ($object->type == 1)
+ {
+ $facreplaced=new Facture($db);
+ $facreplaced->fetch($object->fk_facture_source);
+ print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')';
+ }
+ if ($object->type == 2)
+ {
+ $facusing=new Facture($db);
+ $facusing->fetch($object->fk_facture_source);
+ print ' ('.$langs->transnoentities("CorrectInvoice",$facusing->getNomUrl(1)).')';
+ }
- // Third party
- print ' |
| '.$langs->trans('Company').' | ';
- print ''.$soc->getNomUrl(1,'compta');
- print ' ('.$langs->trans('OtherBills').') | ';
- print '
';
+ $facidavoir=$object->getListIdAvoirFromInvoice();
+ if (count($facidavoir) > 0)
+ {
+ print ' ('.$langs->transnoentities("InvoiceHasAvoir");
+ $i=0;
+ foreach($facidavoir as $id)
+ {
+ if ($i==0) print ' ';
+ else print ',';
+ $facavoir=new Facture($db);
+ $facavoir->fetch($id);
+ print $facavoir->getNomUrl(1);
+ }
+ print ')';
+ }
+ // FIXME $facidnext not defined
+ /*
+ if ($facidnext > 0)
+ {
+ $facthatreplace=new Facture($db);
+ $facthatreplace->fetch($facidnext);
+ print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
+ }
+ */
+ print '';
- // Type
- print '| '.$langs->trans('Type').' | ';
- print $object->getLibType();
- if ($object->type == 1)
- {
- $facreplaced=new Facture($db);
- $facreplaced->fetch($object->fk_facture_source);
- print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')';
- }
- if ($object->type == 2)
- {
- $facusing=new Facture($db);
- $facusing->fetch($object->fk_facture_source);
- print ' ('.$langs->transnoentities("CorrectInvoice",$facusing->getNomUrl(1)).')';
- }
+ // Discounts
+ print ' |
| '.$langs->trans('Discounts').' | ';
+ if ($object->thirdparty->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_client);
+ else print $langs->trans("CompanyHasNoRelativeDiscount");
+ print '. ';
+ if ($absolute_discount > 0)
+ {
+ if ($object->statut > 0 || $object->type == 2 || $object->type == 3)
+ {
+ if ($object->statut == 0)
+ {
+ print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)).'. ';
+ }
+ else
+ {
+ if ($object->statut < 1 || $object->type == 2 || $object->type == 3)
+ {
+ $text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency));
+ print ' '.$text.'. ';
+ }
+ else
+ {
+ $text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency));
+ $text2=$langs->trans("AbsoluteDiscountUse");
+ print $form->textwithpicto($text,$text2);
+ }
+ }
+ }
+ else
+ {
+ // Remise dispo de type non avoir
+ $filter='fk_facture_source IS NULL';
+ print ' ';
+ $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$object->thirdparty->id,$absolute_discount,$filter,$resteapayer);
+ }
+ }
+ if ($absolute_creditnote > 0)
+ {
+ // If validated, we show link "add credit note to payment"
+ if ($object->statut != 1 || $object->type == 2 || $object->type == 3)
+ {
+ if ($object->statut == 0 && $object->type != 3)
+ {
+ $text=$langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency));
+ print $form->textwithpicto($text,$langs->trans("CreditNoteDepositUse"));
+ }
+ else print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency)).'.';
+ }
+ else
+ {
+ // Remise dispo de type avoir
+ $filter='fk_facture_source IS NOT NULL';
+ if (! $absolute_discount) print ' ';
+ $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id_for_payment',$object->thirdparty->id,$absolute_creditnote,$filter,$resteapayer);
+ }
+ }
+ if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.';
+ print ' |
';
- $facidavoir=$object->getListIdAvoirFromInvoice();
- if (count($facidavoir) > 0)
- {
- print ' ('.$langs->transnoentities("InvoiceHasAvoir");
- $i=0;
- foreach($facidavoir as $id)
- {
- if ($i==0) print ' ';
- else print ',';
- $facavoir=new Facture($db);
- $facavoir->fetch($id);
- print $facavoir->getNomUrl(1);
- }
- print ')';
- }
- if ($facidnext > 0)
- {
- $facthatreplace=new Facture($db);
- $facthatreplace->fetch($facidnext);
- print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
- }
- print '';
+ // Date invoice
+ print '';
+ print '| ';
+ print $langs->trans('Date');
+ print ' | ';
+ if ($object->type != 2 && $action != 'editinvoicedate' && ! empty($object->brouillon) && $user->rights->facture->creer) print 'id.'">'.img_edit($langs->trans('SetDate'),1).' | ';
+ print ' ';
+ print ' | ';
- // Discounts
- print ' |
| '.$langs->trans('Discounts').' | ';
- if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
- else print $langs->trans("CompanyHasNoRelativeDiscount");
- print '. ';
- if ($absolute_discount > 0)
- {
- if ($object->statut > 0 || $object->type == 2 || $object->type == 3)
- {
- if ($object->statut == 0)
- {
- print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)).'. ';
- }
- else
- {
- if ($object->statut < 1 || $object->type == 2 || $object->type == 3)
- {
- $text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency));
- print ' '.$text.'. ';
- }
- else
- {
- $text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency));
- $text2=$langs->trans("AbsoluteDiscountUse");
- print $form->textwithpicto($text,$text2);
- }
- }
- }
- else
- {
- // Remise dispo de type non avoir
- $filter='fk_facture_source IS NULL';
- print ' ';
- $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id,0,'remise_id',$soc->id,$absolute_discount,$filter,$resteapayer);
- }
- }
- if ($absolute_creditnote > 0)
- {
- // If validated, we show link "add credit note to payment"
- if ($object->statut != 1 || $object->type == 2 || $object->type == 3)
- {
- if ($object->statut == 0 && $object->type != 3)
- {
- $text=$langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency));
- print $form->textwithpicto($text,$langs->trans("CreditNoteDepositUse"));
- }
- else print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency)).'.';
- }
- else
- {
- // Remise dispo de type avoir
- $filter='fk_facture_source IS NOT NULL';
- if (! $absolute_discount) print ' ';
- $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id,0,'remise_id_for_payment',$soc->id,$absolute_creditnote,$filter,$resteapayer);
- }
- }
- if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.';
- print ' |
';
+ if ($object->type != 2)
+ {
+ if ($action == 'editinvoicedate')
+ {
+ $form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id,$object->date,'invoicedate');
+ }
+ else
+ {
+ print dol_print_date($object->date,'daytext');
+ }
+ }
+ else
+ {
+ print dol_print_date($object->date,'daytext');
+ }
+ print '';
+ print '';
- // Date invoice
- print '';
- print '| ';
- print $langs->trans('Date');
- print ' | ';
- if ($object->type != 2 && $_GET['action'] != 'editinvoicedate' && $object->brouillon && $user->rights->facture->creer) print 'id.'">'.img_edit($langs->trans('SetDate'),1).' | ';
- print ' ';
- print ' | ';
+ // Date payment term
+ print ' |
';
+ print '| ';
+ print $langs->trans('DateMaxPayment');
+ print ' | ';
+ if ($object->type != 2 && $action != 'editpaymentterm' && ! empty($object->brouillon) && $user->rights->facture->creer) print 'id.'">'.img_edit($langs->trans('SetDate'),1).' | ';
+ print ' ';
+ print ' | ';
+ if ($object->type != 2)
+ {
+ if ($action == 'editpaymentterm')
+ {
+ $form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id,$object->date_lim_reglement,'paymentterm');
+ }
+ else
+ {
+ print dol_print_date($object->date_lim_reglement,'daytext');
+ if ($object->date_lim_reglement < ($now - $conf->facture->client->warning_delay) && ! $object->paye && $object->statut == 1 && ! isset($object->am)) print img_warning($langs->trans('Late'));
+ }
+ }
+ else
+ {
+ print ' ';
+ }
+ print ' |
';
- if ($object->type != 2)
- {
- if ($_GET['action'] == 'editinvoicedate')
- {
- $form->form_date($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->date,'invoicedate');
- }
- else
- {
- print dol_print_date($object->date,'daytext');
- }
- }
- else
- {
- print dol_print_date($object->date,'daytext');
- }
- print '';
- print '';
+ // Conditions de reglement
+ print '| ';
+ print '';
+ print ' | ';
+ if ($object->type != 2)
+ {
+ if ($action == 'editconditions')
+ {
+ $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'cond_reglement_id');
+ }
+ else
+ {
+ $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'none');
+ }
+ }
+ else
+ {
+ print ' ';
+ }
+ print ' |
';
- // Date payment term
- print '';
- print '| ';
- print $langs->trans('DateMaxPayment');
- print ' | ';
- if ($object->type != 2 && $_GET['action'] != 'editpaymentterm' && $object->brouillon && $user->rights->facture->creer) print 'id.'">'.img_edit($langs->trans('SetDate'),1).' | ';
- print ' ';
- print ' | ';
- if ($object->type != 2)
- {
- if ($_GET['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,'daytext');
- if ($object->date_lim_reglement < ($now - $conf->facture->client->warning_delay) && ! $object->paye && $object->statut == 1 && ! $object->am) print img_warning($langs->trans('Late'));
- }
- }
- else
- {
- print ' ';
- }
- print ' |
';
+ // Mode de reglement
+ print '| ';
+ print '';
+ print ' | ';
+ if ($action == 'editmode')
+ {
+ $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id');
+ }
+ else
+ {
+ $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none');
+ }
+ print ' |
';
- // Conditions de reglement
- print '| ';
- print '';
- print ' | ';
- if ($object->type != 2)
- {
- if ($_GET['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 ' |
';
+ // Montants
+ print '| '.$langs->trans('AmountHT').' | ';
+ print ''.price($object->total_ht).' | ';
+ print ''.$langs->trans('Currency'.$conf->currency).' |
';
+ print '| '.$langs->trans('AmountVAT').' | '.price($object->total_tva).' | ';
+ print ''.$langs->trans('Currency'.$conf->currency).' |
';
- // Mode de reglement
- print '| ';
- print '';
- print ' | ';
- if ($_GET['action'] == 'editmode')
- {
- $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->mode_reglement_id,'mode_reglement_id');
- }
- else
- {
- $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->mode_reglement_id,'none');
- }
- print ' |
';
+ // Amount Local Taxes
+ if ($mysoc->country_code=='ES')
+ {
+ if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
+ {
+ print '| '.$langs->transcountry("AmountLT1",$mysoc->country_code).' | ';
+ print ''.price($object->total_localtax1).' | ';
+ print ''.$langs->trans("Currency".$conf->currency).' |
';
+ }
+ if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
+ {
+ print '| '.$langs->transcountry("AmountLT2",$mysoc->country_code).' | ';
+ print ''.price($object->total_localtax2).' | ';
+ print ''.$langs->trans("Currency".$conf->currency).' |
';
+ }
+ }
- // Montants
- print '| '.$langs->trans('AmountHT').' | ';
- print ''.price($object->total_ht).' | ';
- print ''.$langs->trans('Currency'.$conf->currency).' |
';
- print '| '.$langs->trans('AmountVAT').' | '.price($object->total_tva).' | ';
- print ''.$langs->trans('Currency'.$conf->currency).' |
';
+ print '| '.$langs->trans('AmountTTC').' | '.price($object->total_ttc).' | ';
+ print ''.$langs->trans('Currency'.$conf->currency).' |
';
- // Amount Local Taxes
- if ($mysoc->country_code=='ES')
- {
- if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
- {
- print '| '.$langs->transcountry("AmountLT1",$mysoc->country_code).' | ';
- print ''.price($object->total_localtax1).' | ';
- print ''.$langs->trans("Currency".$conf->currency).' |
';
- }
- if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
- {
- print '| '.$langs->transcountry("AmountLT2",$mysoc->country_code).' | ';
- print ''.price($object->total_localtax2).' | ';
- print ''.$langs->trans("Currency".$conf->currency).' |
';
- }
- }
+ // Statut
+ print '| '.$langs->trans('Status').' | ';
+ print ''.($object->getLibStatut(4,$totalpaye)).' |
';
- print '| '.$langs->trans('AmountTTC').' | '.price($object->total_ttc).' | ';
- print ''.$langs->trans('Currency'.$conf->currency).' |
';
+ print '| '.$langs->trans("RIB").' | ';
+ print $object->thirdparty->display_rib();
+ print ' |
';
- // Statut
- print '| '.$langs->trans('Status').' | ';
- print ''.($object->getLibStatut(4,$totalpaye)).' |
';
+ print '
';
- print '