New: Possibilit de modifier les conditions de rglements et le mode de paiement sur une facture brouillon.
This commit is contained in:
parent
5aa5f38426
commit
bffcbc1673
@ -73,6 +73,29 @@ if ($_POST["action"] == 'classin')
|
||||
$facture->classin($_POST["projetid"]);
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'setmode')
|
||||
{
|
||||
$facture = new Facture($db);
|
||||
$facture->fetch($_GET["facid"]);
|
||||
$result=$facture->mode_reglement($_POST["mode_reglement_id"]);
|
||||
if ($result < 0) dolibarr_print_error($db,$facture->error);
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'setconditions')
|
||||
{
|
||||
$facture = new Facture($db);
|
||||
$facture->fetch($_GET["facid"]);
|
||||
$result=$facture->cond_reglement($_POST["cond_reglement_id"]);
|
||||
if ($result < 0) dolibarr_print_error($db,$facture->error);
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'classin')
|
||||
{
|
||||
$facture = new Facture($db);
|
||||
$facture->fetch($_GET["facid"]);
|
||||
$facture->classin($_POST["projetid"]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Insertion facture
|
||||
*/
|
||||
@ -94,12 +117,12 @@ if ($_POST["action"] == 'add')
|
||||
}
|
||||
else
|
||||
{
|
||||
$facture->projetid = $_POST["projetid"];
|
||||
$facture->cond_reglement = $_POST["condid"];
|
||||
$facture->mode_reglement = $_POST["mode_reglement"];
|
||||
$facture->amount = $_POST["amount"];
|
||||
$facture->remise = $_POST["remise"];
|
||||
$facture->remise_percent = $_POST["remise_percent"];
|
||||
$facture->projetid = $_POST["projetid"];
|
||||
$facture->cond_reglement_id = $_POST["cond_reglement_id"];
|
||||
$facture->mode_reglement_id = $_POST["mode_reglement_id"];
|
||||
$facture->amount = $_POST["amount"];
|
||||
$facture->remise = $_POST["remise"];
|
||||
$facture->remise_percent = $_POST["remise_percent"];
|
||||
|
||||
if (!$_POST["propalid"] && !$_POST["commandeid"])
|
||||
{
|
||||
@ -555,12 +578,12 @@ if ($_GET["action"] == 'create')
|
||||
// Conditions de réglement
|
||||
$id_condition_paiements_defaut=1;
|
||||
print "<tr><td nowrap>".$langs->trans("PaymentConditions")."</td><td>";
|
||||
$html->select_conditions_paiements($id_condition_paiements_defaut,'condid');
|
||||
$html->select_conditions_paiements($id_condition_paiements_defaut,'cond_reglement_id');
|
||||
print "</td></tr>";
|
||||
|
||||
// Mode de réglement
|
||||
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
|
||||
$html->select_types_paiements('','mode_reglement');
|
||||
$html->select_types_paiements('','mode_reglement_id');
|
||||
print "</td></tr>";
|
||||
|
||||
// Projet
|
||||
@ -864,13 +887,13 @@ else
|
||||
$head[$h][1] = $langs->trans("Preview");
|
||||
$h++;
|
||||
|
||||
if ($fac->mode_reglement == 3)
|
||||
if ($fac->mode_reglement_code == 'PRE')
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("StandingOrders");
|
||||
$h++;
|
||||
}
|
||||
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("Note");
|
||||
$h++;
|
||||
@ -927,16 +950,45 @@ else
|
||||
print '</td></tr>';
|
||||
|
||||
// Conditions et modes de réglement
|
||||
print '<tr><td>'.$langs->trans("PaymentConditions").'</td><td colspan="3">'. $fac->cond_reglement . '</td>';
|
||||
print '<td width="25%">'.$langs->trans("PaymentMode").'</td><td width="25%">'. $fac->mode_reglement . '</td></tr>';
|
||||
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans("PaymentConditions");
|
||||
print '</td>';
|
||||
if ($_GET["action"] != "editconditions" && $fac->brouillon) print '<td align="right"><a href="facture.php?action=editconditions&facid='.$fac->id.'">'.img_edit($langs->trans("SetConditions")).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($_GET["action"] == "editconditions")
|
||||
{
|
||||
$html->form_conditions_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->cond_reglement_id,"cond_reglement_id");
|
||||
}
|
||||
else
|
||||
{
|
||||
$html->form_conditions_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->cond_reglement_id,"none");
|
||||
}
|
||||
print '</td>';
|
||||
print '<td width="25%">';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans("PaymentMode");
|
||||
print '</td>';
|
||||
if ($_GET["action"] != "editmode" && $fac->brouillon) print '<td align="right"><a href="facture.php?action=editmode&facid='.$fac->id.'">'.img_edit($langs->trans("SetMode")).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td width="25%">';
|
||||
if ($_GET["action"] == "editmode")
|
||||
{
|
||||
$html->form_modes_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->mode_reglement_id,"mode_reglement_id");
|
||||
}
|
||||
else
|
||||
{
|
||||
$html->form_modes_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->mode_reglement_id,"none");
|
||||
}
|
||||
print '</td></tr>';
|
||||
print '<tr>';
|
||||
|
||||
// Projet
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
$langs->load("projects");
|
||||
print '<td height="10">';
|
||||
print '<td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans("Project");
|
||||
print '</td>';
|
||||
@ -952,8 +1004,10 @@ else
|
||||
$html->form_project($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->fk_soc,$fac->projetid,"none");
|
||||
}
|
||||
print "</td>";
|
||||
} else {
|
||||
print '<td height="10"> </td><td colspan="3"> </td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td><td colspan="3"> </td>';
|
||||
}
|
||||
|
||||
print '<td rowspan="8" colspan="2" valign="top">';
|
||||
@ -1011,9 +1065,9 @@ else
|
||||
|
||||
print "</td></tr>";
|
||||
|
||||
print "<tr><td height=\"10\">".$langs->trans("Author")."</td><td colspan=\"3\">$author->fullname</td></tr>";
|
||||
print "<tr><td>".$langs->trans("Author")."</td><td colspan=\"3\">$author->fullname</td></tr>";
|
||||
|
||||
print '<tr><td height=\"10\">'.$langs->trans("GlobalDiscount").'</td>';
|
||||
print '<tr><td>'.$langs->trans("GlobalDiscount").'</td>';
|
||||
if ($fac->brouillon == 1 && $user->rights->facture->creer)
|
||||
{
|
||||
print '<form action="facture.php?facid='.$fac->id.'" method="post">';
|
||||
@ -1027,17 +1081,17 @@ else
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td height=\"10\">'.$langs->trans("AmountHT").'</td>';
|
||||
print '<tr><td>'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right" colspan="2"><b>'.price($fac->total_ht).'</b></td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
|
||||
print '<tr><td height=\"10\">'.$langs->trans("VAT").'</td><td align="right" colspan="2">'.price($fac->total_tva).'</td>';
|
||||
print '<tr><td>'.$langs->trans("VAT").'</td><td align="right" colspan="2">'.price($fac->total_tva).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
print '<tr><td height=\"10\">'.$langs->trans("AmountTTC").'</td><td align="right" colspan="2">'.price($fac->total_ttc).'</td>';
|
||||
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td align="right" colspan="2">'.price($fac->total_ttc).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td height=\"10\">'.$langs->trans("Status").'</td><td align="left" colspan="3">'.($fac->getLibStatut()).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td align="left" colspan="3">'.($fac->getLibStatut()).'</td></tr>';
|
||||
|
||||
if ($fac->note)
|
||||
{
|
||||
|
||||
@ -66,188 +66,194 @@ $html = new Form($db);
|
||||
/* *************************************************************************** */
|
||||
|
||||
if ($_GET["facid"] > 0)
|
||||
{
|
||||
$fac = New Facture($db);
|
||||
if ( $fac->fetch($_GET["facid"], $user->societe_id) > 0)
|
||||
{
|
||||
$soc = new Societe($db, $fac->socidp);
|
||||
$soc->fetch($fac->socidp);
|
||||
$author = new User($db);
|
||||
$author->id = $fac->user_author;
|
||||
$author->fetch();
|
||||
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("CardBill");
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/apercu.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("Preview");
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
{
|
||||
$fac = New Facture($db);
|
||||
if ( $fac->fetch($_GET["facid"], $user->societe_id) > 0)
|
||||
{
|
||||
$soc = new Societe($db, $fac->socidp);
|
||||
$soc->fetch($fac->socidp);
|
||||
$author = new User($db);
|
||||
$author->id = $fac->user_author;
|
||||
$author->fetch();
|
||||
|
||||
if ($fac->mode_reglement == 3)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("StandingOrders");
|
||||
$h++;
|
||||
}
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("Note");
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$h++;
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("Bill")." : $fac->ref");
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("CardBill");
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/apercu.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("Preview");
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
|
||||
|
||||
/*
|
||||
* Facture
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td>'.$langs->trans("Company").'</td>';
|
||||
print '<td colspan="5">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Dates
|
||||
print '<tr><td>'.$langs->trans("Date").'</td>';
|
||||
print '<td colspan="3">'.dolibarr_print_date($fac->date,"%A %d %B %Y").'</td>';
|
||||
print '<td>'.$langs->trans("DateClosing").'</td><td>' . dolibarr_print_date($fac->date_lim_reglement,"%A %d %B %Y");
|
||||
if ($fac->paye == 0 && $fac->date_lim_reglement < (time() - $warning_delay)) print img_warning($langs->trans("Late"));
|
||||
print "</td></tr>";
|
||||
if ($fac->mode_reglement_code == 'PRE')
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("StandingOrders");
|
||||
$h++;
|
||||
}
|
||||
|
||||
// Conditions et modes de réglement
|
||||
print '<tr><td>'.$langs->trans("PaymentConditions").'</td><td colspan="3">'. $fac->cond_reglement . '</td>';
|
||||
print '<td width="25%">'.$langs->trans("PaymentMode").'</td><td width="25%">'. $fac->mode_reglement . '</td></tr>';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("Note");
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$h++;
|
||||
|
||||
print '<tr>';
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
$langs->load("projects");
|
||||
print '<td height=\"10\">'.$langs->trans("Project").'</td><td colspan="3">';
|
||||
if ($fac->projetid > 0)
|
||||
{
|
||||
$projet = New Project($db);
|
||||
$projet->fetch($fac->projetid);
|
||||
print '<a href="'.DOL_URL_ROOT.'/projet/fiche.php?id='.$fac->projetid.'">'.$projet->title.'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print " </td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td height=\"10\"> </td><td colspan="3">';
|
||||
print " </td>";
|
||||
}
|
||||
print '<td colspan="2" rowspan="4" valign="top" width="50%">';
|
||||
|
||||
/*
|
||||
* Documents
|
||||
*
|
||||
*/
|
||||
$facref = sanitize_string($fac->ref);
|
||||
$file = $conf->facture->dir_output . "/" . $facref . "/" . $facref . ".pdf";
|
||||
$filedetail = $conf->facture->dir_output . "/" . $facref . "/" . $facref . "-detail.pdf";
|
||||
$relativepath = "${facref}/${facref}.pdf";
|
||||
$relativepathdetail = "${facref}/${facref}-detail.pdf";
|
||||
$relativepathimage = "${facref}/${facref}.pdf.png";
|
||||
|
||||
$fileimage = $file.".png";
|
||||
|
||||
$var=true;
|
||||
|
||||
// Si fichier PDF existe
|
||||
if (file_exists($file))
|
||||
{
|
||||
$encfile = urlencode($file);
|
||||
print_titre($langs->trans("Documents"));
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("Bill")." : $fac->ref");
|
||||
|
||||
|
||||
/*
|
||||
* Facture
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print "<tr $bc[$var]><td>".$langs->trans("Bill")." PDF</td>";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=facture&file='.urlencode($relativepath).'">'.$fac->ref.'.pdf</a></td>';
|
||||
print '<td align="right">'.filesize($file). ' bytes</td>';
|
||||
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'</td>';
|
||||
// Societe
|
||||
print '<tr><td>'.$langs->trans("Company").'</td>';
|
||||
print '<td colspan="5">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Si fichier detail PDF existe
|
||||
if (file_exists($filedetail)) // facture détaillée supplémentaire
|
||||
{
|
||||
print "<tr $bc[$var]><td>Facture détaillée</td>";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=facture&file='.urlencode($relativepathdetail).'">'.$fac->ref.'-detail.pdf</a></td>';
|
||||
print '<td align="right">'.filesize($filedetail). ' bytes</td>';
|
||||
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($filedetail)).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
// Conversion du PDF en image png si fichier png non existant
|
||||
if (!file_exists($fileimage))
|
||||
{
|
||||
if (function_exists(imagick_readimage)) {
|
||||
$handle = imagick_readimage( $file ) ;
|
||||
if ( imagick_iserror( $handle ) )
|
||||
{
|
||||
$reason = imagick_failedreason( $handle ) ;
|
||||
$description = imagick_faileddescription( $handle ) ;
|
||||
|
||||
print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n";
|
||||
}
|
||||
|
||||
imagick_convert( $handle, "PNG" ) ;
|
||||
|
||||
if ( imagick_iserror( $handle ) )
|
||||
{
|
||||
$reason = imagick_failedreason( $handle ) ;
|
||||
$description = imagick_faileddescription( $handle ) ;
|
||||
|
||||
print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n";
|
||||
}
|
||||
|
||||
imagick_writeimage( $handle, $file .".png");
|
||||
}
|
||||
else {
|
||||
$langs->load("other");
|
||||
print $langs->trans("ErrorNoImagickReadimage");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
print "</td></tr>";
|
||||
|
||||
print "<tr><td height=\"10\">".$langs->trans("Author")."</td><td colspan=\"3\">$author->fullname</td>";
|
||||
|
||||
print '<tr><td height=\"10\" nowrap>'.$langs->trans("GlobalDiscount").'</td>';
|
||||
print '<td align="right" colspan="2">'.$fac->remise_percent.'</td>';
|
||||
print '<td>%</td></tr>';
|
||||
|
||||
print '<tr><td height=\"10\">'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right" colspan="2"><b>'.price($fac->total_ht).'</b></td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
// Dates
|
||||
print '<tr><td>'.$langs->trans("Date").'</td>';
|
||||
print '<td colspan="3">'.dolibarr_print_date($fac->date,"%A %d %B %Y").'</td>';
|
||||
print '<td>'.$langs->trans("DateClosing").'</td><td>' . dolibarr_print_date($fac->date_lim_reglement,"%A %d %B %Y");
|
||||
if ($fac->paye == 0 && $fac->date_lim_reglement < (time() - $warning_delay)) print img_warning($langs->trans("Late"));
|
||||
print "</td></tr>";
|
||||
|
||||
// Conditions et modes de réglement
|
||||
print '<tr><td>'.$langs->trans("PaymentConditions").'</td><td colspan="3">';
|
||||
$html->form_conditions_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->cond_reglement_id,"none");
|
||||
print '</td>';
|
||||
print '<td width="25%">'.$langs->trans("PaymentMode").'</td><td width="25%">';
|
||||
$html->form_modes_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->mode_reglement_id,"none");
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr>';
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
$langs->load("projects");
|
||||
print '<td>'.$langs->trans("Project").'</td><td colspan="3">';
|
||||
if ($fac->projetid > 0)
|
||||
{
|
||||
$projet = New Project($db);
|
||||
$projet->fetch($fac->projetid);
|
||||
print '<a href="'.DOL_URL_ROOT.'/projet/fiche.php?id='.$fac->projetid.'">'.$projet->title.'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print " </td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td><td colspan="3">';
|
||||
print " </td>";
|
||||
}
|
||||
print '<td colspan="2" rowspan="4" valign="top" width="50%">';
|
||||
|
||||
/*
|
||||
* Documents
|
||||
*
|
||||
*/
|
||||
$facref = sanitize_string($fac->ref);
|
||||
$file = $conf->facture->dir_output . "/" . $facref . "/" . $facref . ".pdf";
|
||||
$filedetail = $conf->facture->dir_output . "/" . $facref . "/" . $facref . "-detail.pdf";
|
||||
$relativepath = "${facref}/${facref}.pdf";
|
||||
$relativepathdetail = "${facref}/${facref}-detail.pdf";
|
||||
$relativepathimage = "${facref}/${facref}.pdf.png";
|
||||
|
||||
$fileimage = $file.".png";
|
||||
|
||||
$var=true;
|
||||
|
||||
// Si fichier PDF existe
|
||||
if (file_exists($file))
|
||||
{
|
||||
$encfile = urlencode($file);
|
||||
print_titre($langs->trans("Documents"));
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print "<tr $bc[$var]><td>".$langs->trans("Bill")." PDF</td>";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=facture&file='.urlencode($relativepath).'">'.$fac->ref.'.pdf</a></td>';
|
||||
print '<td align="right">'.filesize($file). ' bytes</td>';
|
||||
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Si fichier detail PDF existe
|
||||
if (file_exists($filedetail)) // facture détaillée supplémentaire
|
||||
{
|
||||
print "<tr $bc[$var]><td>Facture détaillée</td>";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=facture&file='.urlencode($relativepathdetail).'">'.$fac->ref.'-detail.pdf</a></td>';
|
||||
print '<td align="right">'.filesize($filedetail). ' bytes</td>';
|
||||
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($filedetail)).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
// Conversion du PDF en image png si fichier png non existant
|
||||
if (!file_exists($fileimage))
|
||||
{
|
||||
if (function_exists(imagick_readimage)) {
|
||||
$handle = imagick_readimage( $file ) ;
|
||||
if ( imagick_iserror( $handle ) )
|
||||
{
|
||||
$reason = imagick_failedreason( $handle ) ;
|
||||
$description = imagick_faileddescription( $handle ) ;
|
||||
|
||||
print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n";
|
||||
}
|
||||
|
||||
imagick_convert( $handle, "PNG" ) ;
|
||||
|
||||
if ( imagick_iserror( $handle ) )
|
||||
{
|
||||
$reason = imagick_failedreason( $handle ) ;
|
||||
$description = imagick_faileddescription( $handle ) ;
|
||||
|
||||
print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n";
|
||||
}
|
||||
|
||||
imagick_writeimage( $handle, $file .".png");
|
||||
}
|
||||
else {
|
||||
$langs->load("other");
|
||||
print $langs->trans("ErrorNoImagickReadimage");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
print "</td></tr>";
|
||||
|
||||
print "<tr><td>".$langs->trans("Author")."</td><td colspan=\"3\">$author->fullname</td>";
|
||||
|
||||
print '<tr><td nowrap>'.$langs->trans("GlobalDiscount").'</td>';
|
||||
print '<td align="right" colspan="2">'.$fac->remise_percent.'</td>';
|
||||
print '<td>%</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right" colspan="2"><b>'.price($fac->total_ht).'</b></td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// Facture non trouvée
|
||||
print $langs->trans("ErrorBillNotFound",$_GET["facid"]);
|
||||
// Facture non trouvée
|
||||
print $langs->trans("ErrorBillNotFound",$_GET["facid"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($fileimage))
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -18,7 +18,6 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -40,33 +39,43 @@ llxHeader();
|
||||
*
|
||||
*/
|
||||
|
||||
$facture = new Facture($db);
|
||||
$facture->fetch($_GET["facid"]);
|
||||
$facture->info($_GET["facid"]);
|
||||
$soc = new Societe($db, $facture->socidp);
|
||||
$soc->fetch($facture->socidp);
|
||||
$fac = new Facture($db);
|
||||
$fac->fetch($_GET["facid"]);
|
||||
$fac->info($_GET["facid"]);
|
||||
$soc = new Societe($db, $fac->socidp);
|
||||
$soc->fetch($fac->socidp);
|
||||
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture.php?facid='.$facture->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("CardBill");
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/apercu.php?facid='.$facture->id;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/apercu.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("Preview");
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$facture->id;
|
||||
|
||||
if ($fac->mode_reglement_code == 'PRE')
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("StandingOrders");
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("Note");
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$facture->id;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("Bill")." : $facture->ref");
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("Bill")." : $fac->ref");
|
||||
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
dolibarr_print_object_info($facture);
|
||||
dolibarr_print_object_info($fac);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -47,8 +47,8 @@ if ($user->societe_id > 0)
|
||||
}
|
||||
|
||||
|
||||
$facture = new Facture($db);
|
||||
$facture->fetch($_GET["facid"]);
|
||||
$fac = new Facture($db);
|
||||
$fac->fetch($_GET["facid"]);
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
@ -57,7 +57,7 @@ $facture->fetch($_GET["facid"]);
|
||||
|
||||
if ($_POST["action"] == 'update' && $user->rights->facture->creer)
|
||||
{
|
||||
$facture->update_note($_POST["note"]);
|
||||
$fac->update_note($_POST["note"]);
|
||||
}
|
||||
|
||||
|
||||
@ -68,83 +68,91 @@ if ($_POST["action"] == 'update' && $user->rights->facture->creer)
|
||||
|
||||
llxHeader();
|
||||
|
||||
$html = new Form($db);
|
||||
|
||||
if ($_GET["facid"])
|
||||
{
|
||||
$soc = new Societe($db, $facture->socidp);
|
||||
$soc->fetch($facture->socidp);
|
||||
$soc = new Societe($db, $fac->socidp);
|
||||
$soc->fetch($fac->socidp);
|
||||
|
||||
$h=0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture.php?facid='.$facture->id;
|
||||
$head[$h][1] = $langs->trans("CardBill");
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/apercu.php?facid='.$facture->id;
|
||||
$head[$h][1] = $langs->trans("Preview");
|
||||
$h++;
|
||||
$h=0;
|
||||
|
||||
if ($facture->mode_reglement == 3)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$facture->id;
|
||||
$head[$h][1] = $langs->trans("StandingOrders");
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$facture->id;
|
||||
$head[$h][1] = $langs->trans("Note");
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$facture->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("CardBill");
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/apercu.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("Preview");
|
||||
$h++;
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("Bill")." : $facture->ref");
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
if ($fac->mode_reglement_code == 'PRE')
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("StandingOrders");
|
||||
$h++;
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans("Company").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></td>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Date").'</td>';
|
||||
print '<td>'.dolibarr_print_date($facture->date,"%A %d %B %Y")."</td>\n";
|
||||
print '<td width="25%">'.$langs->trans("DateClosing").'</td><td width="25%">'.dolibarr_print_date($facture->date_lim_reglement,"%A %d %B %Y") ."</td></tr>";
|
||||
|
||||
// Conditions et modes de réglement
|
||||
print '<tr><td>'.$langs->trans("PaymentConditions").'</td><td>'. $facture->cond_reglement . '</td>';
|
||||
print '<td>'.$langs->trans("PaymentMode").'</td><td>'. $facture->mode_reglement . '</td></tr>';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("Note");
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$h++;
|
||||
|
||||
print '<tr><td valign="top" colspan="4">'.$langs->trans("Note").' :</td></tr>';
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("Bill")." : $fac->ref");
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Company").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></td>';
|
||||
|
||||
// Dates
|
||||
print '<tr><td>'.$langs->trans("Date").'</td>';
|
||||
print '<td>'.dolibarr_print_date($fac->date,"%A %d %B %Y").'</td>';
|
||||
print '<td>'.$langs->trans("DateClosing").'</td><td>' . dolibarr_print_date($fac->date_lim_reglement,"%A %d %B %Y");
|
||||
if ($fac->paye == 0 && $fac->date_lim_reglement < (time() - $warning_delay)) print img_warning($langs->trans("Late"));
|
||||
print "</td></tr>";
|
||||
|
||||
// Conditions et modes de réglement
|
||||
print '<tr><td>'.$langs->trans("PaymentConditions").'</td><td>';
|
||||
$html->form_conditions_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->cond_reglement_id,"none");
|
||||
print '</td>';
|
||||
print '<td width="25%">'.$langs->trans("PaymentMode").'</td><td width="25%">';
|
||||
$html->form_modes_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->mode_reglement_id,"none");
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top" colspan="4">'.$langs->trans("Note").' :</td></tr>';
|
||||
|
||||
print '<tr><td valign="top" colspan="4">'.($fac->note?nl2br($fac->note):" ")."</td></tr>";
|
||||
|
||||
if ($_GET["action"] == 'edit')
|
||||
{
|
||||
print '<form method="post" action="note.php?facid='.$fac->id.'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<tr><td valign="top" colspan="4"><textarea name="note" cols="80" rows="8">'.$fac->note."</textarea></td></tr>";
|
||||
print '<tr><td align="center" colspan="4"><input type="submit" value="'.$langs->trans("Save").'"></td></tr>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
print '</div>';
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->facture->creer && $_GET["action"] <> 'edit')
|
||||
{
|
||||
print "<a class=\"tabAction\" href=\"note.php?facid=$fac->id&action=edit\">".$langs->trans('Edit')."</a>";
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
|
||||
print '<tr><td valign="top" colspan="4">'.($facture->note?nl2br($facture->note):" ")."</td></tr>";
|
||||
|
||||
if ($_GET["action"] == 'edit')
|
||||
{
|
||||
print '<form method="post" action="note.php?facid='.$facture->id.'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<tr><td valign="top" colspan="4"><textarea name="note" cols="80" rows="8">'.$facture->note."</textarea></td></tr>";
|
||||
print '<tr><td align="center" colspan="4"><input type="submit" value="'.$langs->trans("Save").'"></td></tr>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
print '</div>';
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->facture->creer && $_GET["action"] <> 'edit')
|
||||
{
|
||||
print "<a class=\"tabAction\" href=\"note.php?facid=$facture->id&action=edit\">".$langs->trans('Edit')."</a>";
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
|
||||
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -19,14 +19,13 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/facture/prelevement.php
|
||||
\ingroup facture
|
||||
\brief Gestion des prelevement d'une facture
|
||||
\version $Revision$
|
||||
\file htdocs/compta/facture/prelevement.php
|
||||
\ingroup facture
|
||||
\brief Gestion des prelevement d'une facture
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
@ -40,6 +39,18 @@ $langs->load("banks");
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||
|
||||
// Sécurité accés client
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socidp = $user->societe_id;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($_GET["action"] == "new")
|
||||
{
|
||||
$fact = new Facture($db);
|
||||
@ -66,14 +77,7 @@ if ($_GET["action"] == "delete")
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Sécurité accés client
|
||||
*/
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socidp = $user->societe_id;
|
||||
}
|
||||
|
||||
|
||||
llxHeader('',$langs->trans("Bill"));
|
||||
|
||||
@ -86,201 +90,219 @@ $html = new Form($db);
|
||||
/* *************************************************************************** */
|
||||
|
||||
if ($_GET["facid"] > 0)
|
||||
{
|
||||
$fac = New Facture($db);
|
||||
if ( $fac->fetch($_GET["facid"], $user->societe_id) > 0)
|
||||
{
|
||||
$soc = new Societe($db, $fac->socidp);
|
||||
$soc->fetch($fac->socidp);
|
||||
$author = new User($db);
|
||||
$author->id = $fac->user_author;
|
||||
$author->fetch();
|
||||
|
||||
$h = 0;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("CardBill");
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/apercu.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("Preview");
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("StandingOrders");
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("Note");
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$h++;
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("Bill")." : $fac->ref");
|
||||
|
||||
/*
|
||||
* Facture
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td>'.$langs->trans("Company").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print '<b><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></b></td>';
|
||||
|
||||
print "<td>Conditions de réglement : " . $fac->cond_reglement ."</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("Date").'</td>';
|
||||
print "<td colspan=\"3\">".dolibarr_print_date($fac->date,"%A %d %B %Y")."</td>\n";
|
||||
print '<td>'.$langs->trans("DateClosing").dolibarr_print_date($fac->date_lim_reglement,"%A %d %B %Y").'</td></tr>';
|
||||
|
||||
print '<tr><td height="10">'.$langs->trans("Author").'</td><td colspan="4">'.$author->fullname.'</td></tr>';
|
||||
|
||||
print '<tr><td height="10">'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right" colspan="2"><b>'.price($fac->total_ht).'</b></td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td><td> </td></tr>';
|
||||
|
||||
print '<tr><td height="10">'.$langs->trans("AmountTTC").'</td>';
|
||||
print '<td align="right" colspan="2"><b>'.price($fac->total_ttc).'</b></td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td><td> </td></tr>';
|
||||
|
||||
print '<tr><td>RIB</td><td colspan="4">';
|
||||
print $soc->display_rib();
|
||||
print '</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
/*
|
||||
* Demande de prélèvement
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT pfd.rowid, pfd.traite,".$db->pdate("pfd.date_demande")." as date_demande";
|
||||
$sql .= " ,".$db->pdate("pfd.date_traite")." as date_traite";
|
||||
$sql .= " , pfd.amount";
|
||||
$sql .= " , u.name, u.firstname";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE fk_facture = ".$fac->id;
|
||||
$sql .= " AND pfd.fk_user_demande = u.rowid";
|
||||
$sql .= " AND pfd.traite = 0";
|
||||
$sql .= " ORDER BY pfd.date_demande DESC";
|
||||
|
||||
$result_sql = $db->query($sql);
|
||||
if ($result_sql)
|
||||
{
|
||||
$num = $db->num_rows($result_sql);
|
||||
}
|
||||
|
||||
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
|
||||
// Valider
|
||||
if ($fac->statut > 0 && $fac->paye == 0 && $fac->mode_reglement == 3 && $num == 0)
|
||||
{
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
print '<a class="butAction" href="prelevement.php?facid='.$fac->id.'&action=new">Faire une demande de prélèvement</a>';
|
||||
}
|
||||
}
|
||||
print "</div><br/>";
|
||||
|
||||
/*
|
||||
* Prélèvement
|
||||
*/
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="center">Date demande</td>';
|
||||
print '<td align="center">Date traitement</td>';
|
||||
print '<td align="center">'.$langs->trans("Amount").'</td>';
|
||||
print '<td align="center">Bon prélèvement</td>';
|
||||
print '<td align="center">'.$langs->trans("User").'</td><td> </td><td> </td>';
|
||||
print '</tr>';
|
||||
$var=True;
|
||||
|
||||
if ($result_sql)
|
||||
{
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result_sql);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td align="center">'.strftime("%d/%m/%Y",$obj->date_demande)."</td>\n";
|
||||
print '<td align="center">En attente de traitement</td>';
|
||||
print '<td align="center">'.price($obj->amount).'</td>';
|
||||
print '<td align="center">-</td>';
|
||||
print '<td align="center" colspan="2">'.$obj->firstname." ".$obj->name.'</td>';
|
||||
print '<td>';
|
||||
print '<a href="prelevement.php?facid='.$fac->id.'&action=delete&did='.$obj->rowid.'">';
|
||||
print img_delete();
|
||||
print '</a></td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->free($result_sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
$sql = "SELECT pfd.rowid, pfd.traite,".$db->pdate("pfd.date_demande")." as date_demande";
|
||||
$sql .= " ,".$db->pdate("pfd.date_traite")." as date_traite";
|
||||
$sql .= " , pfd.fk_prelevement_bons, pfd.amount";
|
||||
$sql .= " , u.name, u.firstname";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE fk_facture = ".$fac->id;
|
||||
$sql .= " AND pfd.fk_user_demande = u.rowid";
|
||||
$sql .= " AND pfd.traite = 1";
|
||||
$sql .= " ORDER BY pfd.date_demande DESC";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td align="center">'.strftime("%d/%m/%Y",$obj->date_demande)."</td>\n";
|
||||
|
||||
print '<td align="center">'.strftime("%d/%m/%Y",$obj->date_traite)."</td>\n";
|
||||
print '<td align="center">'.price($obj->amount).'</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$obj->fk_prelevement_bons;
|
||||
print '">'.$obj->fk_prelevement_bons."</a></td>\n";
|
||||
|
||||
print '<td align="center" colspan="2">'.$obj->firstname." ".$obj->name.'</td>';
|
||||
|
||||
print '<td>-</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$fac = New Facture($db);
|
||||
if ( $fac->fetch($_GET["facid"], $user->societe_id) > 0)
|
||||
{
|
||||
/* Facture non trouvée */
|
||||
print $langs->trans("ErrorBillNotFound",$_GET["facid"]);
|
||||
$soc = new Societe($db, $fac->socidp);
|
||||
$soc->fetch($fac->socidp);
|
||||
$author = new User($db);
|
||||
$author->id = $fac->user_author;
|
||||
$author->fetch();
|
||||
|
||||
$h = 0;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("CardBill");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/apercu.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("Preview");
|
||||
$h++;
|
||||
|
||||
if ($fac->mode_reglement_code == 'PRE')
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("StandingOrders");
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("Note");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$h++;
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("Bill")." : $fac->ref");
|
||||
|
||||
/*
|
||||
* Facture
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Societe
|
||||
print '<tr><td>'.$langs->trans("Company").'</td>';
|
||||
print '<td colspan="5">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Dates
|
||||
print '<tr><td>'.$langs->trans("Date").'</td>';
|
||||
print '<td colspan="3">'.dolibarr_print_date($fac->date,"%A %d %B %Y").'</td>';
|
||||
print '<td>'.$langs->trans("DateClosing").'</td><td>' . dolibarr_print_date($fac->date_lim_reglement,"%A %d %B %Y");
|
||||
if ($fac->paye == 0 && $fac->date_lim_reglement < (time() - $warning_delay)) print img_warning($langs->trans("Late"));
|
||||
print "</td></tr>";
|
||||
|
||||
// Conditions et modes de réglement
|
||||
print '<tr><td>'.$langs->trans("PaymentConditions").'</td><td colspan="3">';
|
||||
$html->form_conditions_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->cond_reglement_id,"none");
|
||||
print '</td>';
|
||||
print '<td width="25%">'.$langs->trans("PaymentMode").'</td><td width="25%">';
|
||||
$html->form_modes_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->mode_reglement_id,"none");
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right" colspan="2"><b>'.price($fac->total_ht).'</b></td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td><td colspan="2"> </td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("AmountTTC").'</td>';
|
||||
print '<td align="right" colspan="2"><b>'.price($fac->total_ttc).'</b></td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td><td colspan="2"> </td></tr>';
|
||||
|
||||
print '<tr><td>RIB</td><td colspan="5">';
|
||||
print $soc->display_rib();
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
/*
|
||||
* Demande de prélèvement
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT pfd.rowid, pfd.traite,".$db->pdate("pfd.date_demande")." as date_demande";
|
||||
$sql .= " ,".$db->pdate("pfd.date_traite")." as date_traite";
|
||||
$sql .= " , pfd.amount";
|
||||
$sql .= " , u.name, u.firstname";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE fk_facture = ".$fac->id;
|
||||
$sql .= " AND pfd.fk_user_demande = u.rowid";
|
||||
$sql .= " AND pfd.traite = 0";
|
||||
$sql .= " ORDER BY pfd.date_demande DESC";
|
||||
|
||||
$result_sql = $db->query($sql);
|
||||
if ($result_sql)
|
||||
{
|
||||
$num = $db->num_rows($result_sql);
|
||||
}
|
||||
|
||||
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
|
||||
// Valider
|
||||
if ($fac->statut > 0 && $fac->paye == 0 && $fac->mode_reglement_code == 'PRE' && $num == 0)
|
||||
{
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
print '<a class="butAction" href="prelevement.php?facid='.$fac->id.'&action=new">Faire une demande de prélèvement</a>';
|
||||
}
|
||||
}
|
||||
print "</div><br/>";
|
||||
|
||||
/*
|
||||
* Prélèvement
|
||||
*/
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="center">Date demande</td>';
|
||||
print '<td align="center">Date traitement</td>';
|
||||
print '<td align="center">'.$langs->trans("Amount").'</td>';
|
||||
print '<td align="center">Bon prélèvement</td>';
|
||||
print '<td align="center">'.$langs->trans("User").'</td><td> </td><td> </td>';
|
||||
print '</tr>';
|
||||
$var=True;
|
||||
|
||||
if ($result_sql)
|
||||
{
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result_sql);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td align="center">'.strftime("%d/%m/%Y",$obj->date_demande)."</td>\n";
|
||||
print '<td align="center">En attente de traitement</td>';
|
||||
print '<td align="center">'.price($obj->amount).'</td>';
|
||||
print '<td align="center">-</td>';
|
||||
print '<td align="center" colspan="2">'.$obj->firstname." ".$obj->name.'</td>';
|
||||
print '<td>';
|
||||
print '<a href="prelevement.php?facid='.$fac->id.'&action=delete&did='.$obj->rowid.'">';
|
||||
print img_delete();
|
||||
print '</a></td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->free($result_sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
$sql = "SELECT pfd.rowid, pfd.traite,".$db->pdate("pfd.date_demande")." as date_demande";
|
||||
$sql .= " ,".$db->pdate("pfd.date_traite")." as date_traite";
|
||||
$sql .= " , pfd.fk_prelevement_bons, pfd.amount";
|
||||
$sql .= " , u.name, u.firstname";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE fk_facture = ".$fac->id;
|
||||
$sql .= " AND pfd.fk_user_demande = u.rowid";
|
||||
$sql .= " AND pfd.traite = 1";
|
||||
$sql .= " ORDER BY pfd.date_demande DESC";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td align="center">'.strftime("%d/%m/%Y",$obj->date_demande)."</td>\n";
|
||||
|
||||
print '<td align="center">'.strftime("%d/%m/%Y",$obj->date_traite)."</td>\n";
|
||||
print '<td align="center">'.price($obj->amount).'</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$obj->fk_prelevement_bons;
|
||||
print '">'.$obj->fk_prelevement_bons."</a></td>\n";
|
||||
|
||||
print '<td align="center" colspan="2">'.$obj->firstname." ".$obj->name.'</td>';
|
||||
|
||||
print '<td>-</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Facture non trouvée */
|
||||
print $langs->trans("ErrorBillNotFound",$_GET["facid"]);
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -55,8 +55,10 @@ class Facture
|
||||
var $propalid;
|
||||
var $projetid;
|
||||
var $prefixe_facture;
|
||||
var $cond_reglement;
|
||||
var $mode_reglement;
|
||||
var $cond_reglement_id;
|
||||
var $cond_reglement_code;
|
||||
var $mode_reglement_id;
|
||||
var $mode_reglement_code;
|
||||
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
@ -100,14 +102,19 @@ class Facture
|
||||
$_facrec = new FactureRec($this->db, $this->fac_rec);
|
||||
$_facrec->fetch($this->fac_rec);
|
||||
|
||||
$this->projetid = $_facrec->projetid;
|
||||
$this->cond_reglement = $_facrec->cond_reglement_id;
|
||||
$this->amount = $_facrec->amount;
|
||||
$this->remise = $_facrec->remise;
|
||||
$this->remise_percent = $_facrec->remise_percent;
|
||||
$this->projetid = $_facrec->projetid;
|
||||
$this->cond_reglement = $_facrec->cond_reglement_id;
|
||||
$this->cond_reglement_id = $_facrec->cond_reglement_id;
|
||||
$this->mode_reglement = $_facrec->mode_reglement_id;
|
||||
$this->mode_reglement_id = $_facrec->mode_reglement_id;
|
||||
$this->amount = $_facrec->amount;
|
||||
$this->remise = $_facrec->remise;
|
||||
$this->remise_percent = $_facrec->remise_percent;
|
||||
}
|
||||
|
||||
$sql = "SELECT fdm,nbjour FROM ".MAIN_DB_PREFIX."cond_reglement WHERE rowid = $this->cond_reglement";
|
||||
$sql = "SELECT fdm,nbjour ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."cond_reglement";
|
||||
$sql.= " WHERE rowid = ".$this->cond_reglement;
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
@ -151,7 +158,7 @@ class Facture
|
||||
$sql .= " VALUES ('$number','$socid', now(), '$totalht', '$remise'";
|
||||
$sql .= ",'$this->remise_percent', ".$this->db->idate($this->date);
|
||||
$sql .= ",'".addslashes($this->note)."',$user->id, $this->projetid";
|
||||
$sql .= ",".$this->cond_reglement.",".$this->mode_reglement.",".$this->db->idate($datelim).")";
|
||||
$sql .= ",".$this->cond_reglement_id.",".$this->mode_reglement_id.",".$this->db->idate($datelim).")";
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."facture");
|
||||
@ -654,7 +661,7 @@ class Facture
|
||||
*/
|
||||
function set_paiement_started($rowid)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture set fk_statut=2 WHERE rowid = $rowid ;";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture set fk_statut=2 WHERE rowid = ".$rowid;
|
||||
$return = $this->db->query( $sql);
|
||||
}
|
||||
|
||||
@ -664,7 +671,7 @@ class Facture
|
||||
*/
|
||||
function set_canceled($rowid)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture set fk_statut=3 WHERE rowid = $rowid ;";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture set fk_statut=3 WHERE rowid = ".$rowid;
|
||||
$return = $this->db->query( $sql);
|
||||
}
|
||||
|
||||
@ -742,7 +749,9 @@ class Facture
|
||||
{
|
||||
$sql .= ", datef=now()";
|
||||
// du coup, il faut aussi recalculer la date limite de règlement
|
||||
$sqltemp = "SELECT c.fdm,c.nbjour,c.rowid,f.fk_cond_reglement,f.rowid FROM ".MAIN_DB_PREFIX."cond_reglement as c, ".MAIN_DB_PREFIX."facture as f WHERE c.rowid=f.fk_cond_reglement AND f.rowid=$this->id";
|
||||
$sqltemp = "SELECT c.fdm,c.nbjour,c.rowid,f.fk_cond_reglement,f.rowid";
|
||||
$sqltemp.= " FROM ".MAIN_DB_PREFIX."cond_reglement as c, ".MAIN_DB_PREFIX."facture as f";
|
||||
$sqltemp.= " WHERE c.rowid=f.fk_cond_reglement AND f.rowid=".$this->id;
|
||||
if ($this->db->query($sqltemp))
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
@ -1350,38 +1359,76 @@ class Facture
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Change le mode de réglement
|
||||
* \param mode nouveau mode
|
||||
*/
|
||||
function mode_reglement($mode)
|
||||
* \brief Change les conditions de réglement
|
||||
* \param cond_reglement_id Id des nouvelles conditions
|
||||
* \return int >0 si ok, <0 si ko
|
||||
*/
|
||||
function cond_reglement($cond_reglement_id)
|
||||
{
|
||||
//dolibarr_syslog("Facture::ModeReglement");
|
||||
if ($this->statut > 0 && $this->paye == 0)
|
||||
dolibarr_syslog("Facture::cond_reglement($cond_reglement_id)");
|
||||
if ($this->statut >= 0 && $this->paye == 0)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture";
|
||||
$sql .= " SET fk_mode_reglement = ".$mode;
|
||||
$sql .= " SET fk_cond_reglement = ".$cond_reglement_id;
|
||||
$sql .= " WHERE rowid=".$this->id;
|
||||
|
||||
if ( $this->db->query( $sql) )
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
$this->mode_reglement = $mode;
|
||||
return 0;
|
||||
$this->cond_reglement_id = $cond_reglement_id;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("Facture::mode_reglement Erreur -2");
|
||||
return -2;
|
||||
dolibarr_syslog("Facture::cond_reglement Erreur $sql - ".$this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("Facture::mode_reglement, etat facture incompatible");
|
||||
return -3;
|
||||
dolibarr_syslog("Facture::cond_reglement, etat facture incompatible");
|
||||
$this->error="Etat facture incompatible $this->statut $this->paye";
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Change le mode de réglement
|
||||
* \param mode Id du nouveau mode
|
||||
* \return int >0 si ok, <0 si ko
|
||||
*/
|
||||
function mode_reglement($mode_reglement_id)
|
||||
{
|
||||
dolibarr_syslog("Facture::mode_reglement($mode_reglement_id)");
|
||||
if ($this->statut >= 0 && $this->paye == 0)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture";
|
||||
$sql .= " SET fk_mode_reglement = ".$mode_reglement_id;
|
||||
$sql .= " WHERE rowid=".$this->id;
|
||||
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
$this->mode_reglement_id = $mode_reglement_id;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("Facture::mode_reglement Erreur $sql - ".$this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("Facture::mode_reglement, etat facture incompatible");
|
||||
$this->error="Etat facture incompatible $this->statut $this->paye";
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Créé une demande de prélèvement
|
||||
* \param user utilisateur créant la demande
|
||||
*/
|
||||
|
||||
@ -490,12 +490,15 @@ class Form
|
||||
|
||||
|
||||
/**
|
||||
* \brief Charge dans cache la liste des conditions de paiements possibles
|
||||
* \brief Charge dans cache la liste des conditions de paiements possibles
|
||||
* \return int Nb lignes chargées, 0 si déjà chargées, <0 si ko
|
||||
*/
|
||||
function load_cache_conditions_paiements()
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if (sizeof($this->cache_conditions_paiements_code)) return 0; // Cache déja chargé
|
||||
|
||||
dolibarr_syslog('html.form.class.php::load_cache_conditions_paiements');
|
||||
$sql = "SELECT rowid, libelle";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."cond_reglement";
|
||||
@ -525,12 +528,15 @@ class Form
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Charge dans cache la liste des types de paiements possibles
|
||||
* \brief Charge dans cache la liste des types de paiements possibles
|
||||
* \return int Nb lignes chargées, 0 si déjà chargées, <0 si ko
|
||||
*/
|
||||
function load_cache_types_paiements()
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if (sizeof($this->cache_types_paiements_code)) return 0; // Cache déja chargé
|
||||
|
||||
dolibarr_syslog('html.form.class.php::load_cache_types_paiements');
|
||||
$sql = "SELECT id, code, libelle, type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||
@ -552,7 +558,7 @@ class Form
|
||||
$this->cache_types_paiements_type[$obj->id]=$obj->type;
|
||||
$i++;
|
||||
}
|
||||
return 1;
|
||||
return $num;
|
||||
}
|
||||
else {
|
||||
dolibarr_print_error($this->db);
|
||||
@ -563,25 +569,21 @@ class Form
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retourne la liste des types de paiements possibles
|
||||
* \param selected Type de praiement présélectionné
|
||||
* \param htmlname Nom de la zone select
|
||||
* \param filtertype Pour filtre
|
||||
* \brief Retourne la liste des types de paiements possibles
|
||||
* \param selected Id du type de paiement présélectionné
|
||||
* \param htmlname Nom de la zone select
|
||||
* \param filtertype Pour filtre
|
||||
*/
|
||||
function select_conditions_paiements($selected='',$htmlname='condid',$filtertype=-1)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
// Charge le cache si premier appel
|
||||
if (! sizeof($this->cache_conditions_paiements_code))
|
||||
{
|
||||
$this->load_cache_conditions_paiements();
|
||||
}
|
||||
$this->load_cache_conditions_paiements();
|
||||
|
||||
print '<select class="flat" name="'.$htmlname.'">';
|
||||
foreach($this->cache_conditions_paiements_code as $id => $code)
|
||||
{
|
||||
if ($selected == $code)
|
||||
if ($selected == $id)
|
||||
{
|
||||
print '<option value="'.$id.'" selected="true">';
|
||||
}
|
||||
@ -599,8 +601,8 @@ class Form
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retourne la liste des types de paiements possibles
|
||||
* \param selected Type de praiement présélectionné
|
||||
* \brief Retourne la liste des modes de paiements possibles
|
||||
* \param selected Id du mode de paiement présélectionné
|
||||
* \param htmlname Nom de la zone select
|
||||
* \param filtertype Pour filtre
|
||||
* \param format 0=id+libelle, 1=code+code
|
||||
@ -612,13 +614,8 @@ class Form
|
||||
$filterarray=array();
|
||||
if ($filtertype && $filtertype != '-1') $filterarray=split(',',$filtertype);
|
||||
|
||||
// Charge le cache si premier appel
|
||||
if (! sizeof($this->cache_types_paiements_code))
|
||||
{
|
||||
$this->load_cache_types_paiements();
|
||||
}
|
||||
$this->load_cache_types_paiements();
|
||||
|
||||
//dolibarr_syslog('html.form.class.php::select_types_paiements use cache');
|
||||
print '<select class="flat" name="'.$htmlname.'">';
|
||||
foreach($this->cache_types_paiements_code as $id => $code)
|
||||
{
|
||||
@ -627,10 +624,9 @@ class Form
|
||||
|
||||
if ($format == 0) print '<option value="'.$id.'"';
|
||||
if ($format == 1) print '<option value="'.$code.'"';
|
||||
if ($selected == $code)
|
||||
{
|
||||
print ' selected="true"';
|
||||
}
|
||||
// Si selected est text, on compare avec code, sinon avec id
|
||||
if (eregi('[a-z]', $selected) && $selected == $code) print ' selected="true"';
|
||||
elseif ($selected == $id) print ' selected="true"';
|
||||
print '>';
|
||||
if ($format == 0) print $this->cache_types_paiements_libelle[$id];
|
||||
if ($format == 1) print $code;
|
||||
@ -931,13 +927,13 @@ class Form
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Affiche formulaire de selection de projet
|
||||
* \param page Page
|
||||
* \param socid Id societe
|
||||
* \param selected Id projet présélectionné
|
||||
* \param htmlname Nom du formulaire select
|
||||
*/
|
||||
/**
|
||||
* \brief Affiche formulaire de selection de projet
|
||||
* \param page Page
|
||||
* \param socid Id societe
|
||||
* \param selected Id projet présélectionné
|
||||
* \param htmlname Nom du formulaire select
|
||||
*/
|
||||
function form_project($page, $socid, $selected='', $htmlname='projectid')
|
||||
{
|
||||
global $langs;
|
||||
@ -965,12 +961,78 @@ class Form
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Retourne la liste des devies, dans la langue de l'utilisateur
|
||||
* \param selected code devise pré-sélectionnée
|
||||
* \param htmlname nom de la liste deroulante
|
||||
* \todo trier liste sur noms après traduction plutot que avant
|
||||
*/
|
||||
/**
|
||||
* \brief Affiche formulaire de selection de conditions de paiement
|
||||
* \param page Page
|
||||
* \param selected Id condition présélectionnée
|
||||
* \param htmlname Nom du formulaire select
|
||||
*/
|
||||
function form_conditions_reglement($page, $selected='', $htmlname='cond_reglement_id')
|
||||
{
|
||||
global $langs;
|
||||
if ($htmlname != "none")
|
||||
{
|
||||
print '<form method="post" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="setconditions">';
|
||||
print '<table class="noborder" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
$this->select_conditions_paiements($selected,$htmlname);
|
||||
print '</td>';
|
||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table></form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($selected)
|
||||
{
|
||||
$this->load_cache_conditions_paiements();
|
||||
print $this->cache_conditions_paiements_libelle[$selected];
|
||||
} else {
|
||||
print " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Affiche formulaire de selection des modes de reglement
|
||||
* \param page Page
|
||||
* \param selected Id mode présélectionné
|
||||
* \param htmlname Nom du formulaire select
|
||||
*/
|
||||
function form_modes_reglement($page, $selected='', $htmlname='mode_reglement_id')
|
||||
{
|
||||
global $langs;
|
||||
if ($htmlname != "none")
|
||||
{
|
||||
print '<form method="post" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="setmode">';
|
||||
print '<table class="noborder" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
$this->select_types_paiements($selected,$htmlname);
|
||||
print '</td>';
|
||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table></form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($selected)
|
||||
{
|
||||
$this->load_cache_types_paiements();
|
||||
print $this->cache_types_paiements_libelle[$selected];
|
||||
} else {
|
||||
print " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retourne la liste des devises, dans la langue de l'utilisateur
|
||||
* \param selected code devise pré-sélectionnée
|
||||
* \param htmlname nom de la liste deroulante
|
||||
* \todo trier liste sur noms après traduction plutot que avant
|
||||
*/
|
||||
function select_currency($selected='',$htmlname='currency_id')
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user