Fix: Le bit des remises cre sur propales, commandes, contrat n'tait pas propag qd on cre une facture

This commit is contained in:
Laurent Destailleur 2006-08-21 21:46:21 +00:00
parent d208a018b5
commit 159dbad26f
19 changed files with 63 additions and 42 deletions

View File

@ -203,7 +203,7 @@ if ($handle)
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
}
print '<td align="center">';
$html->textwithhelp('',$htmltooltip,1,0);
print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>';
print '</tr>';
@ -319,7 +319,7 @@ while (($file = readdir($handle))!==false)
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($module->option_condreg);
$htmltooltip.='<br><b>'.$langs->trans("MultiLanguage").'</b>: '.yn($module->option_multilang);
print '<td align="center">';
$html->textwithhelp('',$htmltooltip,1,0);
print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'order').'</a>';

View File

@ -229,7 +229,7 @@ while (($file = readdir($handle))!==false)
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo);
$htmltooltip.='<br><b>'.$langs->trans("MultiLanguage").'</b>: '.yn($module->option_multilang);
print '<td align="center">';
$html->textwithhelp('',$htmltooltip,1,0);
print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'" target="specimen">'.img_object($langs->trans("Preview"),'generic').'</a>';

View File

@ -351,7 +351,7 @@ if(is_dir($dir))
$htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':';
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo);
print '<td align="center">';
$html->textwithhelp('',$htmltooltip,1,0);
print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'sending').'</a>';

View File

@ -245,7 +245,7 @@ while (($file = readdir($handle))!==false)
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
}
print '<td align="center">';
$html->textwithhelp('',$htmltooltip,1,0);
print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>';
print "</tr>\n";
@ -361,7 +361,7 @@ while (($file = readdir($handle))!==false)
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($module->option_condreg);
$htmltooltip.='<br><b>'.$langs->trans("MultiLanguage").'</b>: '.yn($module->option_multilang);
print '<td align="center">';
$html->textwithhelp('',$htmltooltip,1,0);
print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';

View File

@ -172,7 +172,7 @@ if ($handle)
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
}
print '<td align="center">';
$html->textwithhelp('',$htmltooltip,1,0);
print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>';
print '</tr>';
@ -284,7 +284,7 @@ while (($file = readdir($handle))!==false)
$htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':';
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo);
print '<td align="center">';
$html->textwithhelp('',$htmltooltip,1,0);
print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'intervention').'</a>';

View File

@ -171,7 +171,7 @@ if ($handle)
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
}
print '<td align="center">';
$html->textwithhelp('',$htmltooltip,1,0);
print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>';
print '</tr>';
@ -286,7 +286,7 @@ while (($file = readdir($handle))!==false)
$htmltooltip.='<br><b>'.$langs->trans("PaymentMode").'</b>: '.yn($module->option_modereg);
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($module->option_condreg);
print '<td align="center">';
$html->textwithhelp('',$htmltooltip,1,0);
print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'order').'</a>';

View File

@ -193,7 +193,7 @@ if ($handle)
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
}
print '<td align="center">';
$html->textwithhelp('',$htmltooltip,1,0);
print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>';
print '</tr>';
@ -310,7 +310,7 @@ if(is_dir($dir))
$htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':';
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo);
print '<td align="center">';
$html->textwithhelp('',$htmltooltip,1,0);
print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'sending').'</a>';

View File

@ -224,7 +224,7 @@ if ($handle)
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
}
print '<td align="center">';
$html->textwithhelp('',$htmltooltip,1,0);
print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>';
print "</tr>\n";
@ -340,7 +340,7 @@ while (($file = readdir($handle))!==false)
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($module->option_condreg);
$htmltooltip.='<br><b>'.$langs->trans("MultiLanguage").'</b>: '.yn($module->option_multilang);
print '<td align="center">';
$html->textwithhelp('',$htmltooltip,1,0);
print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'propal').'</a>';

View File

@ -977,7 +977,7 @@ class Commande extends CommonObject
{
$this->lignes = array();
$sql = 'SELECT l.rowid, l.fk_product, l.fk_commande, l.description, l.price, l.qty, l.tva_tx,';
$sql.= ' l.remise_percent, l.subprice, l.rang, l.coef, l.label,';
$sql.= ' l.remise_percent, l.subprice, l.coef, l.rang, l.info_bits, l.label,';
$sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)';
@ -1008,6 +1008,7 @@ class Commande extends CommonObject
$ligne->fk_product = $objp->fk_product;
$ligne->coef = $objp->coef;
$ligne->rang = $objp->rang;
$ligne->info_bits = $objp->info_bits;
$ligne->ref = $objp->product_ref;
$ligne->libelle = $objp->label; // Label produit

View File

@ -380,7 +380,11 @@ if ($_POST['action'] == 'add')
$lines[$i]->qty,
$lines[$i]->tva_tx,
$lines[$i]->fk_product,
$lines[$i]->remise_percent);
$lines[$i]->remise_percent,
'',
'',
0,
$lines[$i]->info_bits);
}
}
else

View File

@ -336,6 +336,7 @@ class Contrat extends CommonObject
// Selectionne les lignes contrats liées à un produit
$sql = "SELECT p.rowid, p.label, p.description as product_desc, p.ref,";
$sql.= " d.description, d.statut, d.price_ht, d.tva_tx, d.qty, d.remise_percent, d.subprice,";
$sql.= " d.info_bits,";
$sql.= " d.date_ouverture_prevue, d.date_ouverture,";
$sql.= " d.date_fin_validite, d.date_cloture";
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as d, ".MAIN_DB_PREFIX."product as p";
@ -354,17 +355,18 @@ class Contrat extends CommonObject
$ligne = new ContratLigne();
$ligne->id = $objp->rowid;
$ligne->desc = stripslashes($objp->description); // Description ligne
$ligne->libelle = stripslashes($objp->label); // Label produit
$ligne->product_desc = stripslashes($objp->product_desc); // Description produit
$ligne->desc = $objp->description; // Description ligne
$ligne->libelle = $objp->label; // Label produit
$ligne->product_desc = $objp->product_desc; // Description produit
$ligne->qty = $objp->qty;
$ligne->ref = $objp->ref;
$ligne->tva_tx = $objp->tva_tx;
$ligne->subprice = $objp->subprice;
$ligne->statut = $objp->statut;
$ligne->statut = $objp->statut;
$ligne->remise_percent = $objp->remise_percent;
$ligne->price = $objp->price;
$ligne->fk_product = $objp->rowid;
$ligne->info_bits = $objp->info_bits;
$ligne->date_debut_prevue = $objp->date_ouverture_prevue;
$ligne->date_debut_reel = $objp->date_ouverture;

View File

@ -1096,15 +1096,16 @@ class Facture extends CommonObject
* \param date_start Date de debut de validité du service
* \param date_end Date de fin de validité du service
* \param ventil Code de ventilation comptable
* \param info_bits Bits de type de lignes
* \remarks Les parametres sont deja censé etre juste et avec valeurs finales a l'appel
* de cette methode. Aussi, pour le taux tva, il doit deja avoir ete défini
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,taux_produit)
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
*/
function addline($facid, $desc, $pu, $qty, $txtva, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil = 0)
function addline($facid, $desc, $pu, $qty, $txtva, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='')
{
global $conf;
dolibarr_syslog("facture.class.php::addline($facid,$desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil)");
dolibarr_syslog("facture.class.php::addline($facid,$desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits)");
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
if ($this->brouillon)

View File

@ -67,16 +67,19 @@ class Form
\param htmltooltip Contenu html du tooltip
\param direction 1=Le picto est après, -1=le picto est avant
\param usehelpcursor 1=Utilise curseur help, 0=Curseur par defaut
\param string Code html du texte.picto
*/
function textwithhelp($text,$htmltext,$direction=1,$usehelpcursor=1)
{
global $conf;
if (! $htmltext)
{
print $text;
return 1;
return $text;
}
$s="";
// Sanitize tooltip
$paramfortooltip ='';
if ($conf->use_javascript)
@ -86,19 +89,19 @@ class Form
$paramfortooltip.=' onMouseout="hidetip()"';
}
print '<table class="nobordernopadding"><tr>';
$s.='<table class="nobordernopadding"><tr>';
if ($direction > 0)
{
if ($text) print '<td>'.$text.'&nbsp;</td>';
print '<td'.$paramfortooltip.'>'.img_help($usehelpcursor,0).'</td>';
if ($text) $s.='<td>'.$text.'&nbsp;</td>';
$s.='<td'.$paramfortooltip.' valign="top" width="14">'.img_help($usehelpcursor,0).'</td>';
}
else
{
print '<td'.$paramfortooltip.'>'.img_help($usehelpcursor,0).'</td>';
if ($text) print '<td>&nbsp;'.$text.'</td>';
$s.='<td'.$paramfortooltip.' valign="top" width="14">'.img_help($usehelpcursor,0).'</td>';
if ($text) $s.='<td>&nbsp;'.$text.'</td>';
}
print '</tr></table>';
return 1;
$s.='</tr></table>';
return $s;
}
@ -1518,19 +1521,22 @@ class Form
{
print '<tr class="valid"><td class="valid" colspan="3">';
print '<table class="notopnoleftnoright" width="100%">';
print '<tr><td colspan="2">'.$formquestion['text'].'</td></tr>';
print '<tr><td colspan="3" valign="top">'.$formquestion['text'].'</td></tr>';
foreach ($formquestion as $key => $input)
{
if ($input['type'] == 'text') print '<tr><td>'.$input['label'].'</td><td><input type="text" class="flat" name="'.$input['name'].'" size="'.$input['size'].'" value="'.$input['value'].'"></td></tr>';
if ($input['type'] == 'text') print '<tr><td valign="top">'.$input['label'].'</td><td colspan="2"><input type="text" class="flat" name="'.$input['name'].'" size="'.$input['size'].'" value="'.$input['value'].'"></td></tr>';
if ($input['type'] == 'radio')
{
$i=0;
foreach($input['values'] as $selkey => $selval)
{
print '<tr>';
if ($i==0) print '<td>'.$input['label'].'</td>';
if ($i==0) print '<td valign="top">'.$input['label'].'</td>';
else print '<td>&nbsp;</td>';
print '<td><input type="radio" class="flat" name="'.$input['name'].'" value="'.$selkey.'"> '.$selval.'</td></tr>';
print '<td valign="top"><input type="radio" class="flat" name="'.$input['name'].'" value="'.$selkey.'"></td>';
print '<td valign="top">';
print $selval;
print '</td></tr>';
$i++;
}
}

View File

@ -86,7 +86,7 @@ ConfirmValidateBill=Are you sure you want to validate this invoice with referenc
ConfirmClassifyPayedBill=Are you sure you want to change invoice <b>%s</b> to status payed ?
ConfirmCancelBill=Are you sure you want to cancel invoice <b>%s</b> ?
ConfirmClassifyPayedPartially=Are you sure you want to change invoice <b>%s</b> to status payed ?
ConfirmClassifyPayedPartiallyquestion=This invoice has not been payed completely. What are reasons for you to close this invoice ?
ConfirmClassifyPayedPartiallyQuestion=This invoice has not been payed completely. What are reasons for you to close this invoice ?
ConfirmClassifyPayedPartiallyReasonEscompte=Remainder to pay <b>(%s %s)</b> is a discount granted because payment was made before term
ConfirmClassifyPayedPartiallyReasonOther=Other
ValidateBill=Validate invoice

View File

@ -86,9 +86,14 @@ ConfirmValidateBill=
ConfirmClassifyPayedBill=Êtes-vous sûr de vouloir classer la facture <b>%s</b> comme payée ?
ConfirmCancelBill=Êtes-vous sûr de vouloir annuler la facture <b>%s</b> ?
ConfirmClassifyPayedPartially=Êtes-vous sûr de vouloir classer la facture <b>%s</b> comme payée ?
ConfirmClassifyPayedPartiallyQuestion=Cette facture n'a pas été payée complètement. Pour quelle raison voulez-vous la classer magré tout ?
ConfirmClassifyPayedPartiallyReasonEscompte=Le reste à payer <b>(%s %s)</b> est un escompte accordé pour motif de paiement avant échéance
ConfirmClassifyPayedPartiallyQuestion=Cette facture n'a pas été payée à hauteur du montant initial. Pour quelle raison voulez-vous la classer magré tout ?
ConfirmClassifyPayedPartiallyReasonDiscountNoVat=Le reste à payer <b>(%s %s)</b> est un escompte accordé après facture. J'accepte de perdre la TVA sur cet escompte.
ConfirmClassifyPayedPartiallyReasonDiscountVat=Le reste à payer <b>(%s %s)</b> est un escompte accordé après facture. Je récupère la TVA sur cet escompte sans avoir.
ConfirmClassifyPayedPartiallyReasonDiscountAvoir=Le reste à payer <b>(%s %s)</b> est un escompte accordé après facture. Je régularise la TVA par un avoir.
ConfirmClassifyPayedPartiallyReasonOther=Autre
ConfirmClassifyPayedPartiallyNoVat=Ce choix est possible si votre facture était munie de la mention adéquate. (Exemple: « escompte net de taxe »)
ConfirmClassifyPayedPartiallyVat=Ce choix est possible si votre facture était munie de la mention adéquate. (Exemple: «seule la taxe correspondant au prix effectivement payé ouvre droit à déduction»)
ConfirmClassifyPayedPartiallyAvoir=Ce choix est le choix à prendre si les autres ne sont pas applicables
ValidateBill=Valider facture
NumberOfBills=Nb de factures
NumberOfBillsByMonth=Nb de factures par mois

View File

@ -828,7 +828,7 @@ class Propal extends CommonObject
* Lignes propales liées à un produit ou non
*/
$sql = "SELECT d.description, d.price, d.tva_tx, d.qty, d.remise_percent, d.subprice, d.fk_product,";
$sql.= " d.total_ht, d.total_tva, d.total_ttc, d.coef, d.rang,";
$sql.= " d.info_bits, d.total_ht, d.total_tva, d.total_ttc, d.coef, d.rang,";
$sql.= " p.ref, p.label, p.description as product_desc";
$sql.= " FROM ".MAIN_DB_PREFIX."propaldet as d";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON d.fk_product = p.rowid";
@ -854,6 +854,7 @@ class Propal extends CommonObject
$ligne->remise_percent = $objp->remise_percent;
$ligne->price = $objp->price;
$ligne->info_bits = $objp->info_bits;
$ligne->total_ht = $objp->total_ht;
$ligne->total_tva = $objp->total_tva;
$ligne->total_ttc = $objp->total_ttc;

View File

@ -881,7 +881,7 @@ padding: 2px;
#dhtmltooltip
{
position: absolute;
width: 200px;
width: 300px;
border: 1px solid #444444;
padding: 2px;
background-color: lightyellow;

View File

@ -27,8 +27,9 @@ alter table llx_contrat add column note_public text after note;
alter table llx_facture add column note_public text after note;
alter table llx_facture add column remise_absolue real DEFAULT 0 after remise_percent;
alter table llx_facture add column close_code varchar(12) after remise;
alter table llx_facture add column close_code varchar(16) after remise;
alter table llx_facture add column close_note varchar(128) after close_code;
alter table llx_facture modify close_code varchar(16);
alter table llx_propal add column note_public text after note;
alter table llx_propal add column remise_absolue real DEFAULT 0 after remise_percent;

View File

@ -36,7 +36,7 @@ create table llx_facture
remise_absolue real DEFAULT 0, -- remise absolue
remise real DEFAULT 0, -- remise totale calculee
close_code varchar(12), -- Code motif cloture sans paiement complet
close_code varchar(16), -- Code motif cloture sans paiement complet
close_note varchar(128), -- Commentaire cloture sans paiement complet
tva real DEFAULT 0, -- montant tva apres remise totale