Merge pull request #25208 from FliyFly/editfactfournattribute

New attributes on supplier invoice card
This commit is contained in:
Laurent Destailleur 2023-06-27 10:15:51 +02:00 committed by GitHub
commit 0ef66a52fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3372,31 +3372,17 @@ if ($action == 'create') {
print '<table class="border tableforfield centpercent">';
if (isModEnabled("multicurrency") && ($object->multicurrency_code != $conf->currency)) {
// Multicurrency Amount HT
print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
print '<td class="nowrap right amountcard">'.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>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>';
print '<td class="nowrap right amountcard">'.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>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>';
print '<td class="nowrap right amountcard">'.price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
print '</tr>';
print '<tr>';
print '<td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
print '<td class="nowrap amountcard right">' . price($object->total_ht, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
}
// Amount
print '<tr><td class="titlefield">'.$langs->trans('AmountHT').'</td>';
print '<td class="nowrap right amountcard">'.price($object->total_ht, 1, $langs, 0, -1, -1, $conf->currency).'</td>';
print '</tr>';
// VAT
print '<tr><td>'.$langs->trans('AmountVAT').'</td>';
print '<td class="nowrap right amountcard">';
print '<tr>';
print '<td>' . $langs->trans('AmountVAT') . '</td>';
print '<td class="nowrap amountcard right">';
if (GETPOST('calculationrule')) {
$calculationrule = GETPOST('calculationrule', 'alpha');
} else {
@ -3409,32 +3395,41 @@ if ($action == 'create') {
}
// Show link for "recalculate"
if ($object->getVentilExportCompta() == 0) {
$s = '<span class="hideonsmartphone opacitymedium">'.$langs->trans("ReCalculate").' </span>';
$s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=totalofround">'.$langs->trans("Mode1").'</a>';
$s = '<span class="hideonsmartphone opacitymedium">' . $langs->trans("ReCalculate") . ' </span>';
$s .= '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=calculate&calculationrule=totalofround">' . $langs->trans("Mode1") . '</a>';
$s .= ' / ';
$s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=roundoftotal">'.$langs->trans("Mode2").'</a>';
$s .= '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=calculate&calculationrule=roundoftotal">' . $langs->trans("Mode2") . '</a>';
print '<div class="inline-block">';
print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum).'<br>'.$langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help'), '', 3, '', 0, 'recalculate');
print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum) . '<br>' . $langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help'), '', 3, '', 0, 'recalculate');
print '&nbsp; &nbsp; &nbsp; &nbsp;';
print '</div>';
}
print price($object->total_tva, 1, $langs, 0, -1, -1, $conf->currency);
print '</td></tr>';
print '</td>';
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
}
print '</tr>';
// Amount Local Taxes
//TODO: Place into a function to control showing by country or study better option
if ($societe->localtax1_assuj == "1") { //Localtax1
print '<tr><td>'.$langs->transcountry("AmountLT1", $societe->country_code).'</td>';
print '<td class="nowrap right amountcard">'.price($object->total_localtax1, 1, $langs, 0, -1, -1, $conf->currency).'</td>';
print '<tr>';
print '<td>' . $langs->transcountry("AmountLT1", $societe->country_code) . '</td>';
print '<td class="nowrap amountcard right">' . price($object->total_localtax1, 1, $langs, 0, -1, -1, $conf->currency) . '</td>';
print '</tr>';
}
if ($societe->localtax2_assuj == "1") { //Localtax2
print '<tr><td>'.$langs->transcountry("AmountLT2", $societe->country_code).'</td>';
print '<td class="nowrap right amountcard">'.price($object->total_localtax2, 1, $langs, 0, -1, -1, $conf->currency).'</td>';
print '<tr>';
print '<td>' . $langs->transcountry("AmountLT2", $societe->country_code) . '</td>';
print '<td class="nowrap amountcard right">' . price($object->total_localtax2, 1, $langs, 0, -1, -1, $conf->currency) . '</td>';
print '</tr>';
}
print '<tr><td>'.$langs->trans('AmountTTC').'</td>';
print '<td colspan="3" class="nowrap right amountcard">'.price($object->total_ttc, 1, $langs, 0, -1, -1, $conf->currency).'</td>';
print '<tr>';
print '<td>' . $langs->trans('AmountTTC') . '</td>';
print '<td class="nowrap amountcard right">' . price($object->total_ttc, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
}
print '</tr>';
print '</table>';