Work on setup for vat of product payments
This commit is contained in:
parent
8a3e6a0750
commit
8102ae6705
@ -72,35 +72,38 @@ if ($action == 'update') {
|
|||||||
switch ($tax_mode)
|
switch ($tax_mode)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
$value = 'payment';
|
$valuesellproduct = 'invoice';
|
||||||
|
$valuebuyproduct = 'invoice';
|
||||||
|
$valuesellservice = 'payment';
|
||||||
|
$valuebuyservice = 'payment';
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
$value = 'invoice';
|
$valuesellproduct = 'invoice';
|
||||||
|
$valuebuyproduct = 'invoice';
|
||||||
|
$valuesellservice = 'invoice';
|
||||||
|
$valuebuyservice = 'invoice';
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$valuesellproduct = 'payment';
|
||||||
|
$valuebuyproduct = 'payment';
|
||||||
|
$valuesellservice = 'payment';
|
||||||
|
$valuebuyservice = 'payment';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_PRODUCT', 'invoice','chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_PRODUCT', $valuesellproduct,'chaine',0,'',$conf->entity);
|
||||||
if (! $res > 0) $error++;
|
if (! $res > 0) $error++;
|
||||||
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_PRODUCT', 'invoice','chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_PRODUCT', $valuebuyproduct,'chaine',0,'',$conf->entity);
|
||||||
if (! $res > 0) $error++;
|
if (! $res > 0) $error++;
|
||||||
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_SERVICE', $value,'chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_SERVICE', $valuesellservice, 'chaine',0,'',$conf->entity);
|
||||||
if (! $res > 0) $error++;
|
if (! $res > 0) $error++;
|
||||||
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_SERVICE', $value,'chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_SERVICE', $valuebuyservice, 'chaine',0,'',$conf->entity);
|
||||||
if (! $res > 0) $error++;
|
if (! $res > 0) $error++;
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva",'alpha'),'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_INFO_VAT_RETURN", GETPOST("MAIN_INFO_VAT_RETURN",'alpha'),'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_VAT_RETURN", GETPOST("MAIN_INFO_VAT_RETURN",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
// Others options
|
|
||||||
foreach ($list as $constname) {
|
|
||||||
$constvalue = GETPOST($constname, 'alpha');
|
|
||||||
|
|
||||||
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
@ -153,10 +156,11 @@ else
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td width="120">';
|
print '<td width="120">';
|
||||||
$listval=array('0'=>$langs->trans(""),
|
$listval=array(
|
||||||
'1'=>$langs->trans("Monthly"),
|
'0'=>$langs->trans(""),
|
||||||
'2'=>$langs->trans("Quarterly"),
|
'1'=>$langs->trans("Monthly"),
|
||||||
'3'=>$langs->trans("Annual"),
|
'2'=>$langs->trans("Quarterly"),
|
||||||
|
'3'=>$langs->trans("Annual"),
|
||||||
);
|
);
|
||||||
print $form->selectarray("MAIN_INFO_VAT_RETURN", $listval, $conf->global->MAIN_INFO_VAT_RETURN);
|
print $form->selectarray("MAIN_INFO_VAT_RETURN", $listval, $conf->global->MAIN_INFO_VAT_RETURN);
|
||||||
print "</td>";
|
print "</td>";
|
||||||
@ -173,54 +177,77 @@ else
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="titlefield">'.$langs->trans('OptionVatMode').'</td><td>'.$langs->trans('Description').'</td>';
|
print '<td class="titlefield">'.$langs->trans('OptionVatMode').'</td><td>'.$langs->trans('Description').'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
print '<tr class="oddeven"><td width="200"><input type="radio" name="tax_mode" value="0"'.($tax_mode != 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDefault').'</td>';
|
// Standard
|
||||||
|
print '<tr class="oddeven"><td><input type="radio" name="tax_mode" value="0"'.(empty($tax_mode) ? ' checked' : '').'> '.$langs->trans('OptionVATDefault').'</td>';
|
||||||
print '<td>'.nl2br($langs->trans('OptionVatDefaultDesc'));
|
print '<td>'.nl2br($langs->trans('OptionVatDefaultDesc'));
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
print '<tr class="oddeven"><td width="200"><input type="radio" name="tax_mode" value="1"'.($tax_mode == 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDebitOption').'</td>';
|
// On debit for services
|
||||||
|
print '<tr class="oddeven"><td><input type="radio" name="tax_mode" value="1"'.($tax_mode == 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDebitOption').'</td>';
|
||||||
print '<td>'.nl2br($langs->trans('OptionVatDebitOptionDesc'))."</td></tr>\n";
|
print '<td>'.nl2br($langs->trans('OptionVatDebitOptionDesc'))."</td></tr>\n";
|
||||||
|
// On payment for both products and services
|
||||||
|
if ($conf->global->MAIN_FEATURES_LEVEL >= 1)
|
||||||
|
{
|
||||||
|
print '<tr class="oddeven"><td><input type="radio" name="tax_mode" value="2"'.($tax_mode == 2 ? ' checked' : '').'> '.$langs->trans('OptionPaymentForProductAndServices').'</td>';
|
||||||
|
print '<td>'.nl2br($langs->trans('OptionPaymentForProductAndServicesDesc'))."</td></tr>\n";
|
||||||
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print ' -> '.$langs->trans("SummaryOfVatExigibilityUsedByDefault");
|
print load_fiche_titre('', '', '', 0, 0, '', '-> '.$langs->trans("SummaryOfVatExigibilityUsedByDefault"));
|
||||||
//print ' ('.$langs->trans("CanBeChangedWhenMakingInvoice").')';
|
//print ' ('.$langs->trans("CanBeChangedWhenMakingInvoice").')';
|
||||||
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td class="titlefield"> </td><td>'.$langs->trans("Buy").'</td><td>'.$langs->trans("Sell").'</td></tr>';
|
print '<tr class="oddeven"><td class="titlefield"> </td><td>'.$langs->trans("Buy").'</td><td>'.$langs->trans("Sell").'</td></tr>';
|
||||||
|
|
||||||
// Products
|
// Products
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("Product").'</td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("Product").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $langs->trans("OnDelivery");
|
if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment')
|
||||||
print ' ('.$langs->trans("SupposedToBeInvoiceDate").')';
|
{
|
||||||
|
print $langs->trans("OnPayment");
|
||||||
|
print ' ('.$langs->trans("SupposedToBePaymentDate").')';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $langs->trans("OnDelivery");
|
||||||
|
print ' ('.$langs->trans("SupposedToBeInvoiceDate").')';
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $langs->trans("OnDelivery");
|
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment')
|
||||||
print ' ('.$langs->trans("SupposedToBeInvoiceDate").')';
|
{
|
||||||
|
print $langs->trans("OnPayment");
|
||||||
|
print ' ('.$langs->trans("SupposedToBePaymentDate").')';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $langs->trans("OnDelivery");
|
||||||
|
print ' ('.$langs->trans("SupposedToBeInvoiceDate").')';
|
||||||
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Services
|
// Services
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("Services").'</td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("Services").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($tax_mode == 0)
|
if ($conf->global->TAX_MODE_BUY_SERVICE == 'payment')
|
||||||
{
|
{
|
||||||
print $langs->trans("OnPayment");
|
print $langs->trans("OnPayment");
|
||||||
print ' ('.$langs->trans("SupposedToBePaymentDate").')';
|
print ' ('.$langs->trans("SupposedToBePaymentDate").')';
|
||||||
}
|
}
|
||||||
if ($tax_mode == 1)
|
else
|
||||||
{
|
{
|
||||||
print $langs->trans("OnInvoice");
|
print $langs->trans("OnInvoice");
|
||||||
print ' ('.$langs->trans("InvoiceDateUsed").')';
|
print ' ('.$langs->trans("InvoiceDateUsed").')';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($tax_mode == 0)
|
if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment')
|
||||||
{
|
{
|
||||||
print $langs->trans("OnPayment");
|
print $langs->trans("OnPayment");
|
||||||
print ' ('.$langs->trans("SupposedToBePaymentDate").')';
|
print ' ('.$langs->trans("SupposedToBePaymentDate").')';
|
||||||
}
|
}
|
||||||
if ($tax_mode == 1)
|
else
|
||||||
{
|
{
|
||||||
print $langs->trans("OnInvoice");
|
print $langs->trans("OnInvoice");
|
||||||
print ' ('.$langs->trans("InvoiceDateUsed").')';
|
print ' ('.$langs->trans("InvoiceDateUsed").')';
|
||||||
|
|||||||
@ -1546,10 +1546,12 @@ FailedToInitializeMenu=Failed to initialize menu
|
|||||||
##### Tax #####
|
##### Tax #####
|
||||||
TaxSetup=Taxes, social or fiscal taxes and dividends module setup
|
TaxSetup=Taxes, social or fiscal taxes and dividends module setup
|
||||||
OptionVatMode=VAT due
|
OptionVatMode=VAT due
|
||||||
OptionVATDefault=Cash basis
|
OptionVATDefault=Standard basis
|
||||||
OptionVATDebitOption=Accrual basis
|
OptionVATDebitOption=Accrual basis
|
||||||
OptionVatDefaultDesc=VAT is due:<br>- on delivery for goods (we use invoice date)<br>- on payments for services
|
OptionVatDefaultDesc=VAT is due:<br>- on delivery for goods (we use invoice date)<br>- on payments for services
|
||||||
OptionVatDebitOptionDesc=VAT is due:<br>- on delivery for goods (we use invoice date)<br>- on invoice (debit) for services
|
OptionVatDebitOptionDesc=VAT is due:<br>- on delivery for goods (we use invoice date)<br>- on invoice (debit) for services
|
||||||
|
OptionPaymentForProductAndServices=Cash basis for products and services
|
||||||
|
OptionPaymentForProductAndServicesDesc=VAT is due:<br>- on payment for goods<br>- on payments for services
|
||||||
SummaryOfVatExigibilityUsedByDefault=Time of VAT exigibility by default according to chosen option:
|
SummaryOfVatExigibilityUsedByDefault=Time of VAT exigibility by default according to chosen option:
|
||||||
OnDelivery=On delivery
|
OnDelivery=On delivery
|
||||||
OnPayment=On payment
|
OnPayment=On payment
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user