Fix: on peut dterminer un offset diffrent pour les avoirs

This commit is contained in:
Regis Houssin 2007-05-28 18:03:42 +00:00
parent b725cf874e
commit 86650b04a6
2 changed files with 22 additions and 7 deletions

View File

@ -172,7 +172,8 @@ if ($_GET["action"] == 'delete')
if ($_POST["action"] == 'updateMatrice') dolibarr_set_const($db, "FACTURE_NUM_MATRICE",$_POST["matrice"]);
if ($_POST["action"] == 'updatePrefixFacture') dolibarr_set_const($db, "FACTURE_NUM_PREFIX",$_POST["prefixfacture"]);
if ($_POST["action"] == 'updatePrefixAvoir') dolibarr_set_const($db, "AVOIR_NUM_PREFIX",$_POST["prefixavoir"]);
if ($_POST["action"] == 'setOffset') dolibarr_set_const($db, "FACTURE_NUM_DELTA",$_POST["offset"]);
if ($_POST["action"] == 'setOffsetInvoice') dolibarr_set_const($db, "FACTURE_NUM_DELTA",$_POST["offsetinvoice"]);
if ($_POST["action"] == 'setOffsetCreditNote') dolibarr_set_const($db, "AVOIR_NUM_DELTA",$_POST["offsetcreditnote"]);
if ($_POST["action"] == 'setFiscalMonth') dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START",$_POST["fiscalmonth"]);
if ($_POST["action"] == 'setNumRestart') dolibarr_set_const($db, "FACTURE_NUM_RESTART_BEGIN_YEAR",$_POST["numrestart"]);
if ($_POST["action"] == 'setNumWithInvoice') dolibarr_set_const($db, "AVOIR_NUM_WITH_INVOICE",$_POST["numwithinvoice"]);

View File

@ -91,11 +91,20 @@ function info()
$texte.= '<td aligne="center">'.$form->textwithhelp('',$langs->trans("PrefixCreditNoteDesc"),1,1).'</td>';
$texte.= '</tr></form>';
// On détermine un offset sur le compteur
$texte.= '<tr><td>Appliquer un offset sur le compteur</td>';
// On détermine un offset sur le compteur des factures
$texte.= '<tr><td>Appliquer un offset sur le compteur des factures</td>';
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte.= '<input type="hidden" name="action" value="setOffset">';
$texte.= '<td align="right"><input type="text" class="flat" size="30" name="offset" value="'.$conf->global->FACTURE_NUM_DELTA.'"></td>';
$texte.= '<input type="hidden" name="action" value="setOffsetInvoice">';
$texte.= '<td align="right"><input type="text" class="flat" size="30" name="offsetinvoice" value="'.$conf->global->FACTURE_NUM_DELTA.'"></td>';
$texte.= '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
$texte.= '<td aligne="center">'.$form->textwithhelp('',$langs->trans("OffsetDesc"),1,1).'</td>';
$texte.= '</tr></form>';
// On détermine un offset sur le compteur des avoirs
$texte.= '<tr><td>Appliquer un offset sur le compteur des avoirs</td>';
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte.= '<input type="hidden" name="action" value="setOffsetCreditNote">';
$texte.= '<td align="right"><input type="text" class="flat" size="30" name="offsetcreditnote" value="'.$conf->global->AVOIR_NUM_DELTA.'"></td>';
$texte.= '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
$texte.= '<td aligne="center">'.$form->textwithhelp('',$langs->trans("OffsetDesc"),1,1).'</td>';
$texte.= '</tr></form>';
@ -196,7 +205,7 @@ function info()
if ($row) $searchyy = substr($row[0],0,-$posindice);
}
if ($conf->global->PROPALE_NUM_DELTA != '')
if ($conf->global->FACTURE_NUM_DELTA != '')
{
//on vérifie si il y a une année précédente
//pour éviter que le delta soit appliqué de nouveau sur la nouvelle année
@ -226,11 +235,16 @@ function info()
$max = $row[0];
}
}
else if ($conf->global->FACTURE_NUM_DELTA != '' && !eregi('^'.$this->searchLastWithPreviousYear.'',$previousyy))
else if ($facture->type == 1 && $conf->global->FACTURE_NUM_DELTA != '' && !eregi('^'.$this->searchLastWithPreviousYear.'',$previousyy))
{
// on applique le delta une seule fois
$max=$conf->global->FACTURE_NUM_DELTA?$conf->global->FACTURE_NUM_DELTA-1:0;
}
else if ($facture->type == 2 && $conf->global->AVOIR_NUM_DELTA != '' && !eregi('^'.$this->searchLastWithPreviousYear.'',$previousyy))
{
// on applique le delta une seule fois
$max=$conf->global->AVOIR_NUM_DELTA?$conf->global->AVOIR_NUM_DELTA-1:0;
}
else
{
$max=0;