Grouped VAT

Add an option to group VAT by rate in receipt
This commit is contained in:
David Beniamine 2019-03-13 11:56:21 +01:00
parent 48a0c447b4
commit 4b61f0d606
No known key found for this signature in database
GPG Key ID: DFC3C8C672850E10
4 changed files with 35 additions and 4 deletions

View File

@ -55,4 +55,5 @@ Numberspad=Numbers Pad
BillsCoinsPad=Bills and Coins Pad
DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr
TakeposNeedsCategories=TakePOS needs product categories to work
OrderNotes=Order Notes
OrderNotes=Order Notes
TicketVatGrouped=Group VAT by rate in tickets

View File

@ -49,3 +49,4 @@ AmountAtEndOfPeriod=Montant en fin de période (jour, mois ou année)
TheoricalAmount=Montant théorique
RealAmount=Montant réel
CashFenceDone=Clôture de caisse faite pour la période
TicketVatGrouped=Grouper la TVA par taux dans les tickets

View File

@ -61,6 +61,7 @@ if (GETPOST('action', 'alpha') == 'set')
$res = dolibarr_set_const($db, "TAKEPOSCONNECTOR", GETPOST('TAKEPOSCONNECTOR', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_BAR_RESTAURANT", GETPOST('TAKEPOS_BAR_RESTAURANT', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_TICKET_VAT_GROUPPED", GETPOST('TAKEPOS_TICKET_VAT_GROUPPED', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_ORDER_NOTES", GETPOST('TAKEPOS_ORDER_NOTES', 'alpha'), 'chaine', 0, '', $conf->entity);
@ -146,6 +147,7 @@ if ($conf->global->TAKEPOSCONNECTOR){
print '</td></tr>';
}
// Bar Restaurant mode
print '<tr class="oddeven"><td>';
print 'Bar Restaurant';
@ -167,6 +169,12 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOSCONNECTOR){
print '</td></tr>';
}
print '<tr class="oddeven"><td>';
print $langs->trans('TicketVatGrouped');
print '<td colspan="2">';
print $form->selectyesno("TAKEPOS_TICKET_VAT_GROUPPED", $conf->global->TAKEPOS_TICKET_VAT_GROUPPED, 1);
print "</td></tr>\n";
// Payment numpad
print '<tr class="oddeven"><td>';
print $langs->trans("Paymentnumpad");
@ -225,7 +233,7 @@ print "</tr>\n";
print '<tr class="oddeven"><td width=\"50%\">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
print '<td colspan="2">';
print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY, 'socid', 's.client in (1,3) AND s.status = 1', 1, 0, 0, array(), 0);
print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY, 'socid', 's.client in (1, 3) AND s.status = 1', 1, 0, 0, array(), 0);
print '</td></tr>';
if (! empty($conf->banque->enabled))
{

View File

@ -103,11 +103,32 @@ print $object->ref;
<th class="right"><?php echo $langs->trans("TotalHT");?></th>
<td class="right"><?php echo price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td>
</tr>
<?php if($conf->global->TAKEPOS_TICKET_VAT_GROUPPED):?>
<?php
$vat_groups = array();
foreach ($object->lines as $line)
{
if(!array_key_exists($line->tva_tx, $vat_groups)){
$vat_groups[$line->tva_tx] = 0;
}
$vat_groups[$line->tva_tx] += $line->total_tva;
}
foreach($vat_groups as $key => $val){
?>
<tr>
<th align="right"><?php echo $langs->trans("VAT").' '.vatrate($key, 1);?></th>
<td align="right"><?php echo price($val, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td>
</tr>
<?php
}
?>
<?php else: ?>
<tr>
<th class="right"><?php echo $langs->trans("TotalVAT").'</th><td class="right">'.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td>
<th class="right"><?php echo $langs->trans("TotalVAT").'</th><td class="right">'.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td>
</tr>
<?php endif ?>
<tr>
<th class="right"><?php echo ''.$langs->trans("TotalTTC").'</th><td class="right">'.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td>
<th class="right"><?php echo ''.$langs->trans("TotalTTC").'</th><td class="right">'.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td>
</tr>
</table>
<div style="border-top-style: double;">