Changes to support deposit invoices

This commit is contained in:
Laurent Destailleur 2009-03-02 18:17:19 +00:00
parent d92ab8874b
commit d4e5647b7e
8 changed files with 286 additions and 156 deletions

View File

@ -117,7 +117,7 @@ if ($_socid > 0)
*/ */
$head = societe_prepare_head($objsoc); $head = societe_prepare_head($objsoc);
dol_fiche_head($head, 'absolutediscount', $objsoc->nom); dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"));
print '<form method="POST" action="remx.php?id='.$objsoc->id.'">'; print '<form method="POST" action="remx.php?id='.$objsoc->id.'">';
@ -125,6 +125,12 @@ if ($_socid > 0)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Name
print '<tr><td width="38%">'.$langs->trans('Name').'</td>';
print '<td>';
print $form->showrefnav($objsoc,'id','',1,'rowid','nom');
print '</td></tr>';
// Calcul avoirs en cours // Calcul avoirs en cours
$remise_all=$remise_user=0; $remise_all=$remise_user=0;
$sql = "SELECT SUM(rc.amount_ht) as amount, rc.fk_user"; $sql = "SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
@ -191,12 +197,14 @@ if ($_socid > 0)
{ {
print_titre($langs->trans("DiscountStillRemaining")); print_titre($langs->trans("DiscountStillRemaining"));
print '<table width="100%" class="noborder">'; print '<table width="100%" class="noborder">';
print '<tr class="liste_titre"><td width="120">'.$langs->trans("Date").'</td>'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("ReasonDiscount").'</td>'; print '<td width="110" align="left">'.$langs->trans("Date").'</td>';
print '<td align="left">'.$langs->trans("ReasonDiscount").'</td>';
print '<td align="left" nowrap="nowrap">'.$langs->trans("ConsumedBy").'</td>';
print '<td width="120" align="right">'.$langs->trans("AmountHT").'</td>'; print '<td width="120" align="right">'.$langs->trans("AmountHT").'</td>';
print '<td width="80" align="right">'.$langs->trans("VATRate").'</td>'; print '<td width="80" align="right">'.$langs->trans("VATRate").'</td>';
print '<td width="120" align="right">'.$langs->trans("AmountTTC").'</td>'; print '<td width="120" align="right">'.$langs->trans("AmountTTC").'</td>';
print '<td align="center" width="100">'.$langs->trans("DiscountOfferedBy").'</td>'; print '<td width="100" align="center">'.$langs->trans("DiscountOfferedBy").'</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
@ -209,33 +217,38 @@ if ($_socid > 0)
$var = !$var; $var = !$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td>'.dol_print_date($obj->dc,'dayhour').'</td>'; print '<td>'.dol_print_date($obj->dc,'dayhour').'</td>';
print '<td>';
if ($obj->description == '(CREDIT_NOTE)') if ($obj->description == '(CREDIT_NOTE)')
{ {
print '<td nowrap="nowrap">';
$facturestatic->id=$obj->fk_facture_source; $facturestatic->id=$obj->fk_facture_source;
$facturestatic->ref=$obj->ref; $facturestatic->ref=$obj->ref;
$facturestatic->type=$obj->type; $facturestatic->type=$obj->type;
print $langs->trans("CreditNote").' '.$facturestatic->getNomURl(1); print $langs->trans("CreditNote").' '.$facturestatic->getNomURl(1);
print '</td>';
} }
elseif ($obj->description == '(DEPOSIT)') elseif ($obj->description == '(DEPOSIT)')
{ {
print '<td nowrap="nowrap">';
$facturestatic->id=$obj->fk_facture_source; $facturestatic->id=$obj->fk_facture_source;
$facturestatic->ref=$obj->ref; $facturestatic->ref=$obj->ref;
$facturestatic->type=$obj->type; $facturestatic->type=$obj->type;
print $langs->trans("InvoiceDeposit").' '.$facturestatic->getNomURl(1); print $langs->trans("InvoiceDeposit").' '.$facturestatic->getNomURl(1);
print '</td>';
} }
else else
{ {
print '<td>';
print $obj->description; print $obj->description;
}
print '</td>'; print '</td>';
}
print '<td align="left" nowrap="nowrap">'.$langs->trans("NotConsumed").'</td>';
print '<td align="right">'.price($obj->amount_ht).'</td>'; print '<td align="right">'.price($obj->amount_ht).'</td>';
print '<td align="right">'.price2num($obj->tva_tx,'MU').'%</td>'; print '<td align="right">'.price2num($obj->tva_tx,'MU').'%</td>';
print '<td align="right">'.price($obj->amount_ttc).'</td>'; print '<td align="right">'.price($obj->amount_ttc).'</td>';
print '<td align="center">'; print '<td align="center">';
print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login; print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a>';
print '</td>'; print '</td>';
if ($obj->user_id == $user->id) print '<td><a href="'.$_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&amp;action=remove&amp;remid='.$obj->rowid.'">'.img_delete($langs->trans("RemoveDiscount")).'</td>'; if ($obj->user_id == $user->id) print '<td><a href="'.$_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&amp;action=remove&amp;remid='.$obj->rowid.'">'.img_delete($langs->trans("RemoveDiscount")).'</a></td>';
else print '<td>&nbsp;</td>'; else print '<td>&nbsp;</td>';
print '</tr>'; print '</tr>';
$i++; $i++;
@ -251,8 +264,9 @@ if ($_socid > 0)
print '<br>'; print '<br>';
/* /*
* Liste ristournes appliqu<EFBFBD>es (=liees a une ligne de facture ou facture) * Liste ristournes appliquees (=liees a une ligne de facture ou facture)
*/ */
// Remises liees a lignes de factures // Remises liees a lignes de factures
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,"; $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
$sql.= $db->pdate("rc.datec")." as dc, rc.description, rc.fk_facture_line, rc.fk_facture,"; $sql.= $db->pdate("rc.datec")." as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
@ -295,13 +309,14 @@ if ($_socid > 0)
{ {
print_titre($langs->trans("DiscountAlreadyCounted")); print_titre($langs->trans("DiscountAlreadyCounted"));
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="120">'.$langs->trans("Date").'</td>'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("ReasonDiscount").'</td>'; print '<td width="110" align="left">'.$langs->trans("Date").'</td>';
print '<td align="left">'.$langs->trans("Invoice").'</td>'; print '<td align="left">'.$langs->trans("ReasonDiscount").'</td>';
print '<td align="left" nowrap="nowrap">'.$langs->trans("ConsumedBy").'</td>';
print '<td width="120" align="right">'.$langs->trans("AmountHT").'</td>'; print '<td width="120" align="right">'.$langs->trans("AmountHT").'</td>';
print '<td width="80" align="right">'.$langs->trans("VATRate").'</td>'; print '<td width="80" align="right">'.$langs->trans("VATRate").'</td>';
print '<td width="120" align="right">'.$langs->trans("AmountTTC").'</td>'; print '<td width="120" align="right">'.$langs->trans("AmountTTC").'</td>';
print '<td align="center" width="100">'.$langs->trans("Author").'</td>'; print '<td width="100" align="center">'.$langs->trans("Author").'</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
@ -335,32 +350,36 @@ if ($_socid > 0)
$var = !$var; $var = !$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td>'.dol_print_date($obj->dc,'dayhour').'</td>'; print '<td>'.dol_print_date($obj->dc,'dayhour').'</td>';
print '<td>';
if ($obj->description == '(CREDIT_NOTE)') if ($obj->description == '(CREDIT_NOTE)')
{ {
print '<td nowrap="nowrap">';
$facturestatic->id=$obj->fk_facture_source; $facturestatic->id=$obj->fk_facture_source;
$facturestatic->ref=$obj->ref; $facturestatic->ref=$obj->ref;
$facturestatic->type=$obj->type; $facturestatic->type=$obj->type;
print $langs->trans("CreditNote").' '.$facturestatic->getNomURl(1); print $langs->trans("CreditNote").' '.$facturestatic->getNomURl(1);
print '</td>';
} }
elseif ($obj->description == '(DEPOSIT)') elseif ($obj->description == '(DEPOSIT)')
{ {
print '<td nowrap="nowrap">';
$facturestatic->id=$obj->fk_facture_source; $facturestatic->id=$obj->fk_facture_source;
$facturestatic->ref=$obj->ref; $facturestatic->ref=$obj->ref;
$facturestatic->type=$obj->type; $facturestatic->type=$obj->type;
print $langs->trans("InvoiceDeposit").' '.$facturestatic->getNomURl(1); print $langs->trans("InvoiceDeposit").' '.$facturestatic->getNomURl(1);
print '</td>';
} }
else else
{ {
print '<td>';
print $obj->description; print $obj->description;
}
print '</td>'; print '</td>';
print '<td align="left"><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),'bill').' '.$obj->facnumber.'</a></td>'; }
print '<td align="left" nowrap="nowrap"><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),'bill').' '.$obj->facnumber.'</a></td>';
print '<td align="right">'.price($obj->amount_ht).'</td>'; print '<td align="right">'.price($obj->amount_ht).'</td>';
print '<td align="right">'.price2num($obj->tva_tx,'MU').'%</td>'; print '<td align="right">'.price2num($obj->tva_tx,'MU').'%</td>';
print '<td align="right">'.price($obj->amount_ttc).'</td>'; print '<td align="right">'.price($obj->amount_ttc).'</td>';
print '<td align="center">'; print '<td align="center">';
print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login; print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a>';
print '</td>'; print '</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '</tr>'; print '</tr>';

View File

@ -2156,10 +2156,11 @@ else
} }
if ($fac->type == 2) if ($fac->type == 2)
{ {
$facreplaced=new Facture($db); $facusing=new Facture($db);
$facreplaced->fetch($fac->fk_facture_source); $facusing->fetch($fac->fk_facture_source);
print ' ('.$langs->transnoentities("CorrectInvoice",$facreplaced->getNomUrl(1)).')'; print ' ('.$langs->transnoentities("CorrectInvoice",$facusing->getNomUrl(1)).')';
} }
$facidavoir=$fac->getListIdAvoirFromInvoice(); $facidavoir=$fac->getListIdAvoirFromInvoice();
if (sizeof($facidavoir) > 0) if (sizeof($facidavoir) > 0)
{ {
@ -2191,10 +2192,18 @@ else
if ($absolute_discount > 0) if ($absolute_discount > 0)
{ {
if ($fac->statut > 0 || $fac->type == 2 || $fac->type == 3) if ($fac->statut > 0 || $fac->type == 2 || $fac->type == 3)
{
if ($fac->statut == 0)
{ {
print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->monnaie)).'. '; print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->monnaie)).'. ';
} }
else else
{
$text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->monnaie));
print $html->textwithhelp($text,$langs->trans("AbsoluteDiscountUse"));
}
}
else
{ {
// Remise dispo de type non avoir // Remise dispo de type non avoir
$filter='fk_facture_source IS NULL'; $filter='fk_facture_source IS NULL';
@ -2206,10 +2215,14 @@ else
{ {
// If validated, we show link "add credit note to payment" // If validated, we show link "add credit note to payment"
if ($fac->statut != 1 || $fac->type == 2 || $fac->type == 3) if ($fac->statut != 1 || $fac->type == 2 || $fac->type == 3)
{
if ($fac->statut == 0 && $fac->type != 3)
{ {
$text=$langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->monnaie)); $text=$langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->monnaie));
print $html->textwithhelp($text,$langs->trans("CreditNoteDepositUse")); print $html->textwithhelp($text,$langs->trans("CreditNoteDepositUse"));
} }
else print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->monnaie)).'.';
}
else else
{ {
// Remise dispo de type avoir // Remise dispo de type avoir
@ -2254,9 +2267,89 @@ else
print '<td rowspan="'.$nbrows.'" colspan="2" valign="top">'; print '<td rowspan="'.$nbrows.'" colspan="2" valign="top">';
print '<table class="noborder" width="100%">';
// List of payments already done
print '<tr class="liste_titre">';
print '<td>'.($fac->type == 2 ? $langs->trans("PaymentsBack") : $langs->trans('Payments')).'</td>';
print '<td>'.$langs->trans('Type').'</td>';
print '<td align="right">'.$langs->trans('Amount').'</td>';
print '<td width="18">&nbsp;</td>';
print '</tr>';
$var=true;
/* /*
* List of payments * List of payments
*/ */
// Payments already done (from deposits)
/*
$depositamount=0;
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
$sql.= " re.description, re.fk_facture_source, re.fk_facture_source";
$sql.= " FROM ".MAIN_DB_PREFIX ."societe_remise_except as re";
$sql.= " WHERE fk_facture = ".$fac->id;
$resql=$db->query($sql);
if ($resql)
{
$numdeposits = $db->num_rows($resql);
$i = 0;
$invoice=new Facture($db);
// Loop on each deposit applied
while ($i < $numdeposits)
{
$objinvoice = $db->fetch_object($resql);
$invoice->fetch($objinvoice->fk_facture_source);
if ($invoice->type != 3) continue; // only deposits
// For each deposits, get payments
$sql = 'SELECT '.$db->pdate('datep').' as dp, pf.amount,';
$sql.= ' c.libelle as paiement_type, p.num_paiement, p.rowid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p, '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement_facture as pf';
$sql.= ' WHERE pf.fk_facture = '.$invoice->id.' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid';
$sql.= ' ORDER BY dp, tms';
$resqlpayment = $db->query($sql);
if ($resqlpayment)
{
$numpayments = $db->num_rows($resqlpayment);
$j = 0;
while ($j < $numpayments)
{
$objpayment = $db->fetch_object($resqlpayement);
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$objpayment->rowid.'">'.img_object($langs->trans('ShowPayment'),'payment').' ';
print dol_print_date($objpayment->dp,'day').'</a>';
print ' ('.$langs->trans("Deposit").' ';
print $invoice->getNomUrl(0).')';
print '</td>';
print '<td>'.$objpayment->paiement_type.' '.$objpayement->num_paiement.'</td>';
print '<td align="right">'.price($objpayment->amount).'</td>';
// Remove deposit invoice
print '<td align="right">';
print '<a href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=unlinkdiscount&discountid='.$objinvoice->rowid.'">'.img_delete().'</a>';
print '</td>';
print '</tr>';
$j++;
$depositamount += $obj->amount;
}
}
$i++;
}
}
else
{
dol_print_error($db);
}
*/
// Payments already done (from payment on this invoice)
$sql = 'SELECT '.$db->pdate('datep').' as dp, pf.amount,'; $sql = 'SELECT '.$db->pdate('datep').' as dp, pf.amount,';
$sql.= ' c.libelle as paiement_type, p.num_paiement, p.rowid'; $sql.= ' c.libelle as paiement_type, p.num_paiement, p.rowid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p, '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement_facture as pf'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p, '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement_facture as pf';
@ -2268,19 +2361,9 @@ else
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
print '<table class="noborder" width="100%">';
// List of payments already done
print '<tr class="liste_titre">';
print '<td>'.($fac->type == 2 ? $langs->trans("PaymentsBack") : $langs->trans('Payments')).'</td>';
print '<td>'.$langs->trans('Type').'</td>';
print '<td align="right">'.$langs->trans('Amount').'</td>';
print '<td width="18">&nbsp;</td>';
print '</tr>';
if ($fac->type != 2) if ($fac->type != 2)
{ {
$var=True;
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
@ -2294,17 +2377,27 @@ else
print '</tr>'; print '</tr>';
$i++; $i++;
} }
}
$db->free($result);
}
else
{
dol_print_error($db);
}
// Already payed if ($fac->type != 2)
print '<tr><td colspan="2" align="right">'.$langs->trans('AlreadyPayed').' :</td><td align="right"><b>'.price($totalpaye).'</b></td><td>&nbsp;</td></tr>'; {
// Total already payed
print '<tr><td colspan="2" align="right">';
if ($fac->type != 3) print $langs->trans('AlreadyPayedNoCreditNotesNoDeposits');
else print $langs->trans('AlreadyPayed');
print ' :</td><td align="right">'.price($totalpaye).'</td><td>&nbsp;</td></tr>';
// Billed
print '<tr><td colspan="2" align="right">'.$langs->trans("Billed").' :</td><td align="right" style="border: 1px solid;">'.price($fac->total_ttc).'</td><td>&nbsp;</td></tr>';
$resteapayeraffiche=$resteapayer; $resteapayeraffiche=$resteapayer;
// Loop on each credit note or deposit amount applied
$creditnoteamount=0; $creditnoteamount=0;
$depositamount=0;
// Loop on each credit note applied
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
$sql.= " re.description, re.fk_facture_source, re.fk_facture_source"; $sql.= " re.description, re.fk_facture_source, re.fk_facture_source";
$sql.= " FROM ".MAIN_DB_PREFIX ."societe_remise_except as re"; $sql.= " FROM ".MAIN_DB_PREFIX ."societe_remise_except as re";
@ -2324,12 +2417,13 @@ else
if ($invoice->type == 3) print $langs->trans("Deposit").' '; if ($invoice->type == 3) print $langs->trans("Deposit").' ';
print $invoice->getNomUrl(0); print $invoice->getNomUrl(0);
print ' :</td>'; print ' :</td>';
print '<td align="right" style="border: 1px solid;">'.price($obj->amount_ttc).'</td>'; print '<td align="right">'.price($obj->amount_ttc).'</td>';
print '<td align="right">'; print '<td align="right">';
print '<a href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=unlinkdiscount&discountid='.$obj->rowid.'">'.img_delete().'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=unlinkdiscount&discountid='.$obj->rowid.'">'.img_delete().'</a>';
print '</td></tr>'; print '</td></tr>';
$i++; $i++;
$creditnoteamount += $obj->amount_ttc; if ($invoice->type == 2) $creditnoteamount += $obj->amount_ttc;
if ($invoice->type == 3) $depositamount += $obj->amount_ttc;
} }
} }
else else
@ -2342,7 +2436,7 @@ else
{ {
print '<tr><td colspan="2" align="right" nowrap="1">'; print '<tr><td colspan="2" align="right" nowrap="1">';
print $html->textwithhelp($langs->trans("Escompte").':',$langs->trans("HelpEscompte"),-1); print $html->textwithhelp($langs->trans("Escompte").':',$langs->trans("HelpEscompte"),-1);
print '</td><td align="right">'.price($fac->total_ttc - $creditnoteamount - $totalpaye).'</td><td>&nbsp;</td></tr>'; print '</td><td align="right">'.price($fac->total_ttc - $creditnoteamount - $depositamount - $totalpaye).'</td><td>&nbsp;</td></tr>';
$resteapayeraffiche=0; $resteapayeraffiche=0;
} }
// Payé partiellement ou Abandon 'badcustomer' // Payé partiellement ou Abandon 'badcustomer'
@ -2350,7 +2444,7 @@ else
{ {
print '<tr><td colspan="2" align="right" nowrap="1">'; print '<tr><td colspan="2" align="right" nowrap="1">';
print $html->textwithhelp($langs->trans("Abandoned").':',$langs->trans("HelpAbandonBadCustomer"),-1); print $html->textwithhelp($langs->trans("Abandoned").':',$langs->trans("HelpAbandonBadCustomer"),-1);
print '</td><td align="right">'.price($fac->total_ttc - $creditnoteamount - $totalpaye).'</td><td>&nbsp;</td></tr>'; print '</td><td align="right">'.price($fac->total_ttc - $creditnoteamount - $depositamount - $totalpaye).'</td><td>&nbsp;</td></tr>';
//$resteapayeraffiche=0; //$resteapayeraffiche=0;
} }
// Payé partiellement ou Abandon 'product_returned' // Payé partiellement ou Abandon 'product_returned'
@ -2358,7 +2452,7 @@ else
{ {
print '<tr><td colspan="2" align="right" nowrap="1">'; print '<tr><td colspan="2" align="right" nowrap="1">';
print $html->textwithhelp($langs->trans("ProductReturned").':',$langs->trans("HelpAbandonProductReturned"),-1); print $html->textwithhelp($langs->trans("ProductReturned").':',$langs->trans("HelpAbandonProductReturned"),-1);
print '</td><td align="right">'.price($fac->total_ttc - $creditnoteamount - $totalpaye).'</td><td>&nbsp;</td></tr>'; print '</td><td align="right">'.price($fac->total_ttc - $creditnoteamount - $depositamount - $totalpaye).'</td><td>&nbsp;</td></tr>';
$resteapayeraffiche=0; $resteapayeraffiche=0;
} }
// Payé partiellement ou Abandon 'abandon' // Payé partiellement ou Abandon 'abandon'
@ -2368,15 +2462,20 @@ else
$text=$langs->trans("HelpAbandonOther"); $text=$langs->trans("HelpAbandonOther");
if ($fac->close_note) $text.='<br><br><b>'.$langs->trans("Reason").'</b>:'.$fac->close_note; if ($fac->close_note) $text.='<br><br><b>'.$langs->trans("Reason").'</b>:'.$fac->close_note;
print $html->textwithhelp($langs->trans("Abandoned").':',$text,-1); print $html->textwithhelp($langs->trans("Abandoned").':',$text,-1);
print '</td><td align="right">'.price($fac->total_ttc - $creditnoteamount - $totalpaye).'</td><td>&nbsp;</td></tr>'; print '</td><td align="right">'.price($fac->total_ttc - $creditnoteamount - $depositamount - $totalpaye).'</td><td>&nbsp;</td></tr>';
$resteapayeraffiche=0; $resteapayeraffiche=0;
} }
// Billed
print '<tr><td colspan="2" align="right">'.$langs->trans("Billed").' :</td><td align="right" style="border: 1px solid;">'.price($fac->total_ttc).'</td><td>&nbsp;</td></tr>';
// Remainder to pay
print '<tr><td colspan="2" align="right">'; print '<tr><td colspan="2" align="right">';
if ($resteapayeraffiche >= 0) print $langs->trans('RemainderToPay'); if ($resteapayeraffiche >= 0) print $langs->trans('RemainderToPay');
else print $langs->trans('ExcessReceived'); else print $langs->trans('ExcessReceived');
print ' :</td>'; print ' :</td>';
print '<td align="right" style="border: 1px solid;" bgcolor="#f0f0f0"><b>'.price($resteapayeraffiche).'</b></td>'; print '<td align="right" style="border: 1px solid;" bgcolor="#f0f0f0"><b>'.price($resteapayeraffiche).'</b></td>';
print '<td wrap="nowrap">&nbsp;</td></tr>'; print '<td nowrap="nowrap">&nbsp;</td></tr>';
} }
else else
{ {
@ -2384,13 +2483,8 @@ else
print '<tr><td colspan="2" align="right">'.$langs->trans('TotalTTCToYourCredit').' :</td>'; print '<tr><td colspan="2" align="right">'.$langs->trans('TotalTTCToYourCredit').' :</td>';
print '<td align="right" style="border: 1px solid;" bgcolor="#f0f0f0"><b>'.price(abs($fac->total_ttc)).'</b></td><td>&nbsp;</td></tr>'; print '<td align="right" style="border: 1px solid;" bgcolor="#f0f0f0"><b>'.price(abs($fac->total_ttc)).'</b></td><td>&nbsp;</td></tr>';
} }
print '</table>'; print '</table>';
$db->free($result);
}
else
{
dol_print_error($db);
}
print '</td></tr>'; print '</td></tr>';

View File

@ -201,7 +201,7 @@ print '</table>';
* Liste des factures * Liste des factures
*/ */
$allow_delete = 1 ; $allow_delete = 1 ;
$sql = 'SELECT f.facnumber, f.total_ttc, pf.amount, f.rowid as facid, f.paye, f.fk_statut, s.nom, s.rowid as socid'; $sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.total_ttc, f.paye, f.fk_statut, pf.amount, s.nom, s.rowid as socid';
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s'; $sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s';
$sql .= ' WHERE pf.fk_facture = f.rowid AND f.fk_soc = s.rowid'; $sql .= ' WHERE pf.fk_facture = f.rowid AND f.fk_soc = s.rowid';
$sql .= ' AND pf.fk_paiement = '.$paiement->id; $sql .= ' AND pf.fk_paiement = '.$paiement->id;
@ -231,9 +231,12 @@ if ($resql)
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$objp->facid.'">'.img_object($langs->trans('ShowBill'),'bill').' '; print '<td>';
print $objp->facnumber; $facturestatic->id=$objp->facid;
print "</a></td>\n"; $facturestatic->ref=$objp->facnumber;
$facturestatic->type=$objp->type;
print $facturestatic->getNomUrl(1);
print "</td>\n";
print '<td align="center">'.$facturestatic->LibStatut($objp->paye,$objp->fk_statut,2,1).'</td>'; print '<td align="center">'.$facturestatic->LibStatut($objp->paye,$objp->fk_statut,2,1).'</td>';
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$objp->socid.'">'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.'</a></td>'; print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$objp->socid.'">'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.'</a></td>';
print '<td align="right">'.price($objp->amount).'</td>'; print '<td align="right">'.price($objp->amount).'</td>';

View File

@ -490,7 +490,7 @@ class Form
/** /**
* \brief Retourne la liste déroulante des remises fixes * \brief Return HTML combo list of absolute discounts
* \param selected Id remise fixe pré-sélectionnée * \param selected Id remise fixe pré-sélectionnée
* \param htmlname Nom champ formulaire * \param htmlname Nom champ formulaire
* \param filter Criteres optionnels de filtre * \param filter Criteres optionnels de filtre
@ -1750,10 +1750,10 @@ class Form
print '<td align="left">'; print '<td align="left">';
if ($nbqualifiedlines > 0) if ($nbqualifiedlines > 0)
{ {
print ' <input type="submit" class="button" value="'; print ' &nbsp; <input type="submit" class="button" value="';
if (! $filter || $filter=='fk_facture_source IS NULL') print $langs->trans("UseDiscount"); if (! $filter || $filter=='fk_facture_source IS NULL') print $langs->trans("UseDiscount");
else print $langs->trans("UseCreditNoteInInvoicePayment"); else print $langs->trans("UseCredit");
print '">'; print '" title="'.$langs->trans("UseCreditNoteInInvoicePayment").'">';
} }
print '</td>'; print '</td>';
print '</tr></table></form>'; print '</tr></table></form>';

View File

@ -32,6 +32,9 @@ ReplacementByInvoice=Replaced by invoice
CorrectInvoice=Correct invoice %s CorrectInvoice=Correct invoice %s
CorrectInvoice=Correct invoice %s CorrectInvoice=Correct invoice %s
CorrectionInvoice=Correction invoice CorrectionInvoice=Correction invoice
UsedByInvoice=Used to pay invoice %s
ConsumedBy=Consumed by
NotConsumed=Not consumed
NoReplacableInvoice=No replacable invoices NoReplacableInvoice=No replacable invoices
NoInvoiceToCorrect=No invoice to correct NoInvoiceToCorrect=No invoice to correct
InvoiceHasAvoir=Corrected by one or several invoices InvoiceHasAvoir=Corrected by one or several invoices
@ -171,6 +174,7 @@ ShowInvoiceDeposit=Show deposit invoice
ShowPayment=Show payment ShowPayment=Show payment
File=File File=File
AlreadyPayed=Already payed AlreadyPayed=Already payed
AlreadyPayedNoCreditNotesNoDeposits=Alreday payed (without credit notes and deposits)
Abandoned=Abandoned Abandoned=Abandoned
RemainderToPay=Remainder to pay RemainderToPay=Remainder to pay
RemainderToTake=Remainder to take RemainderToTake=Remainder to take
@ -232,6 +236,8 @@ Deposit=Deposit
Deposits=Deposits Deposits=Deposits
DiscountFromCreditNote=Discount from credit note %s DiscountFromCreditNote=Discount from credit note %s
DiscountFromDeposit=Payments from deposit invoice %s DiscountFromDeposit=Payments from deposit invoice %s
AbsoluteDiscountUse=This kind of credit can be used on invoice before its validation
CreditNoteDepositUse=Invoice must be validated to use this king of credits
NewGlobalDiscount=New discount NewGlobalDiscount=New discount
NoteReason=Note/Reason NoteReason=Note/Reason
ReasonDiscount=Reason ReasonDiscount=Reason
@ -318,7 +324,8 @@ LawApplicationPart3=the seller until the complete cashing of
LawApplicationPart4=their price. LawApplicationPart4=their price.
LimitedLiabilityCompanyCapital=SARL with Capital of LimitedLiabilityCompanyCapital=SARL with Capital of
UseDiscount=Use discount UseDiscount=Use discount
UseCreditNoteInInvoicePayment=Reduce payment with this credit UseCredit=Use credit
UseCreditNoteInInvoicePayment=Reduce amount to pay with this credit
MenuChequeDeposits=Cheques deposits MenuChequeDeposits=Cheques deposits
MenuCheques=Cheques MenuCheques=Cheques
MenuChequesReceipts=Cheques receipts MenuChequesReceipts=Cheques receipts

View File

@ -32,6 +32,9 @@ ReplacedByInvoice=Remplacée par la facture %s
ReplacementByInvoice=Remplacée par facture ReplacementByInvoice=Remplacée par facture
CorrectInvoice=Correction facture %s CorrectInvoice=Correction facture %s
CorrectionInvoice=Correction facture CorrectionInvoice=Correction facture
UsedByInvoice=Appliqué sur facture %s
ConsumedBy=Consommé par
NotConsumed=Non consommé
NoReplacableInvoice=Pas de factures remplacables NoReplacableInvoice=Pas de factures remplacables
NoInvoiceToCorrect=Pas de factures à corriger NoInvoiceToCorrect=Pas de factures à corriger
InvoiceHasAvoir=Corrigée par un ou plusieurs avoirs InvoiceHasAvoir=Corrigée par un ou plusieurs avoirs
@ -171,6 +174,7 @@ ShowInvoiceDeposit=Afficher facture d'accompte
ShowPayment=Afficher réglement ShowPayment=Afficher réglement
File=Fichier File=Fichier
AlreadyPayed=Déjà réglé AlreadyPayed=Déjà réglé
AlreadyPayedNoCreditNotesNoDeposits=Déjà réglé (hors avoirs et accomptes)
Abandoned=Abandonné Abandoned=Abandonné
RemainderToPay=Reste à payer RemainderToPay=Reste à payer
RemainderToTake=Reste à encaisser RemainderToTake=Reste à encaisser
@ -231,6 +235,8 @@ Deposit=Accompte
Deposits=Accomptes Deposits=Accomptes
DiscountFromCreditNote=Remise issue de l'avoir %s DiscountFromCreditNote=Remise issue de l'avoir %s
DiscountFromDeposit=Paiements issue de l'accompte %s DiscountFromDeposit=Paiements issue de l'accompte %s
AbsoluteDiscountUse=Ce type de crédit ne peut s'utiliser que sur un facture avant sa validation
CreditNoteDepositUse=La facture doit être validée pour pouvoir utiliser ce type de crédits
NewGlobalDiscount=Nouvelle remise fixe NewGlobalDiscount=Nouvelle remise fixe
NoteReason=Note/Motif NoteReason=Note/Motif
ReasonDiscount=Motif ReasonDiscount=Motif
@ -319,7 +325,8 @@ LawApplicationPart3=vendeur jusqu'à complet encaissement de
LawApplicationPart4=leurs prix. LawApplicationPart4=leurs prix.
LimitedLiabilityCompanyCapital=SARL au Capital de LimitedLiabilityCompanyCapital=SARL au Capital de
UseDiscount=Appliquer remise UseDiscount=Appliquer remise
UseCreditNoteInInvoicePayment=Réduire paiement avec ce credit UseCredit=Utiliser crédit
UseCreditNoteInInvoicePayment=Réduire le montant du reste à payé avec ce credit
MenuChequeDeposits=Remises de chèques MenuChequeDeposits=Remises de chèques
MenuCheques=Gestion chèques MenuCheques=Gestion chèques
MenuChequesReceipts=Bordereaux MenuChequesReceipts=Bordereaux

View File

@ -130,7 +130,7 @@ CustomerAbsoluteDiscountShort=Remise fixe
CompanyHasRelativeDiscount=Ce client a une remise par défaut de <b>%s%%</b> CompanyHasRelativeDiscount=Ce client a une remise par défaut de <b>%s%%</b>
CompanyHasNoRelativeDiscount=Ce client n'a pas de remises relatives par défaut CompanyHasNoRelativeDiscount=Ce client n'a pas de remises relatives par défaut
CompanyHasAbsoluteDiscount=Ce client a <b>%s %s</b> de remises fixes disponibles CompanyHasAbsoluteDiscount=Ce client a <b>%s %s</b> de remises fixes disponibles
CompanyHasCreditNote=Ce client a <b>%s %s</b> d'avoirs ou accomptes disponibles CompanyHasCreditNote=Ce client a <b>%s %s</b> d'avoirs/accomptes disponibles
CompanyHasNoAbsoluteDiscount=Ce client n'a pas ou plus de remises fixes disponibles CompanyHasNoAbsoluteDiscount=Ce client n'a pas ou plus de remises fixes disponibles
CustomerAbsoluteDiscountAllUsers=Remises fixes en cours (accordées par tout utilisateur) CustomerAbsoluteDiscountAllUsers=Remises fixes en cours (accordées par tout utilisateur)
CustomerAbsoluteDiscountMy=Remises fixes en cours (accordées personnellement) CustomerAbsoluteDiscountMy=Remises fixes en cours (accordées personnellement)

View File

@ -965,7 +965,7 @@ else
print '<form name="formsoc" method="post">'; print '<form name="formsoc" method="post">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// // Name
print '<tr><td width="20%">'.$langs->trans('Name').'</td>'; print '<tr><td width="20%">'.$langs->trans('Name').'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print $form->showrefnav($soc,'socid','',1,'rowid','nom'); print $form->showrefnav($soc,'socid','',1,'rowid','nom');