73 |
$facture->classin($_POST["projetid"]); |
$facture->classin($_POST["projetid"]); |
74 |
} |
} |
75 |
|
|
76 |
|
if ($_POST["action"] == 'setmode') |
77 |
|
{ |
78 |
|
$facture = new Facture($db); |
79 |
|
$facture->fetch($_GET["facid"]); |
80 |
|
$result=$facture->mode_reglement($_POST["mode_reglement_id"]); |
81 |
|
if ($result < 0) dolibarr_print_error($db,$facture->error); |
82 |
|
} |
83 |
|
|
84 |
|
if ($_POST["action"] == 'setconditions') |
85 |
|
{ |
86 |
|
$facture = new Facture($db); |
87 |
|
$facture->fetch($_GET["facid"]); |
88 |
|
$result=$facture->cond_reglement($_POST["cond_reglement_id"]); |
89 |
|
if ($result < 0) dolibarr_print_error($db,$facture->error); |
90 |
|
} |
91 |
|
|
92 |
|
if ($_POST["action"] == 'classin') |
93 |
|
{ |
94 |
|
$facture = new Facture($db); |
95 |
|
$facture->fetch($_GET["facid"]); |
96 |
|
$facture->classin($_POST["projetid"]); |
97 |
|
} |
98 |
|
|
99 |
/* |
/* |
100 |
* Insertion facture |
* Insertion facture |
101 |
*/ |
*/ |
117 |
} |
} |
118 |
else |
else |
119 |
{ |
{ |
120 |
$facture->projetid = $_POST["projetid"]; |
$facture->projetid = $_POST["projetid"]; |
121 |
$facture->cond_reglement = $_POST["condid"]; |
$facture->cond_reglement_id = $_POST["cond_reglement_id"]; |
122 |
$facture->mode_reglement = $_POST["mode_reglement"]; |
$facture->mode_reglement_id = $_POST["mode_reglement_id"]; |
123 |
$facture->amount = $_POST["amount"]; |
$facture->amount = $_POST["amount"]; |
124 |
$facture->remise = $_POST["remise"]; |
$facture->remise = $_POST["remise"]; |
125 |
$facture->remise_percent = $_POST["remise_percent"]; |
$facture->remise_percent = $_POST["remise_percent"]; |
126 |
|
|
127 |
if (!$_POST["propalid"] && !$_POST["commandeid"]) |
if (!$_POST["propalid"] && !$_POST["commandeid"]) |
128 |
{ |
{ |
578 |
// Conditions de réglement |
// Conditions de réglement |
579 |
$id_condition_paiements_defaut=1; |
$id_condition_paiements_defaut=1; |
580 |
print "<tr><td nowrap>".$langs->trans("PaymentConditions")."</td><td>"; |
print "<tr><td nowrap>".$langs->trans("PaymentConditions")."</td><td>"; |
581 |
$html->select_conditions_paiements($id_condition_paiements_defaut,'condid'); |
$html->select_conditions_paiements($id_condition_paiements_defaut,'cond_reglement_id'); |
582 |
print "</td></tr>"; |
print "</td></tr>"; |
583 |
|
|
584 |
// Mode de réglement |
// Mode de réglement |
585 |
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>"; |
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>"; |
586 |
$html->select_types_paiements('','mode_reglement'); |
$html->select_types_paiements('','mode_reglement_id'); |
587 |
print "</td></tr>"; |
print "</td></tr>"; |
588 |
|
|
589 |
// Projet |
// Projet |
887 |
$head[$h][1] = $langs->trans("Preview"); |
$head[$h][1] = $langs->trans("Preview"); |
888 |
$h++; |
$h++; |
889 |
|
|
890 |
if ($fac->mode_reglement == 3) |
if ($fac->mode_reglement_code == 'PRE') |
891 |
{ |
{ |
892 |
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$fac->id; |
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$fac->id; |
893 |
$head[$h][1] = $langs->trans("StandingOrders"); |
$head[$h][1] = $langs->trans("StandingOrders"); |
894 |
$h++; |
$h++; |
895 |
} |
} |
896 |
|
|
897 |
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$fac->id; |
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$fac->id; |
898 |
$head[$h][1] = $langs->trans("Note"); |
$head[$h][1] = $langs->trans("Note"); |
899 |
$h++; |
$h++; |
950 |
print '</td></tr>'; |
print '</td></tr>'; |
951 |
|
|
952 |
// Conditions et modes de réglement |
// Conditions et modes de réglement |
953 |
print '<tr><td>'.$langs->trans("PaymentConditions").'</td><td colspan="3">'. $fac->cond_reglement . '</td>'; |
print '<tr><td>'; |
954 |
print '<td width="25%">'.$langs->trans("PaymentMode").'</td><td width="25%">'. $fac->mode_reglement . '</td></tr>'; |
print '<table class="nobordernopadding" width="100%"><tr><td>'; |
955 |
|
print $langs->trans("PaymentConditions"); |
956 |
|
print '</td>'; |
957 |
|
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>'; |
958 |
|
print '</tr></table>'; |
959 |
|
print '</td><td colspan="3">'; |
960 |
|
if ($_GET["action"] == "editconditions") |
961 |
|
{ |
962 |
|
$html->form_conditions_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->cond_reglement_id,"cond_reglement_id"); |
963 |
|
} |
964 |
|
else |
965 |
|
{ |
966 |
|
$html->form_conditions_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->cond_reglement_id,"none"); |
967 |
|
} |
968 |
|
print '</td>'; |
969 |
|
print '<td width="25%">'; |
970 |
|
print '<table class="nobordernopadding" width="100%"><tr><td>'; |
971 |
|
print $langs->trans("PaymentMode"); |
972 |
|
print '</td>'; |
973 |
|
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>'; |
974 |
|
print '</tr></table>'; |
975 |
|
print '</td><td width="25%">'; |
976 |
|
if ($_GET["action"] == "editmode") |
977 |
|
{ |
978 |
|
$html->form_modes_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->mode_reglement_id,"mode_reglement_id"); |
979 |
|
} |
980 |
|
else |
981 |
|
{ |
982 |
|
$html->form_modes_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->mode_reglement_id,"none"); |
983 |
|
} |
984 |
|
print '</td></tr>'; |
985 |
print '<tr>'; |
print '<tr>'; |
986 |
|
|
987 |
// Projet |
// Projet |
988 |
if ($conf->projet->enabled) |
if ($conf->projet->enabled) |
989 |
{ |
{ |
990 |
$langs->load("projects"); |
$langs->load("projects"); |
991 |
print '<td height="10">'; |
print '<td>'; |
992 |
print '<table class="nobordernopadding" width="100%"><tr><td>'; |
print '<table class="nobordernopadding" width="100%"><tr><td>'; |
993 |
print $langs->trans("Project"); |
print $langs->trans("Project"); |
994 |
print '</td>'; |
print '</td>'; |
1004 |
$html->form_project($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->fk_soc,$fac->projetid,"none"); |
$html->form_project($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->fk_soc,$fac->projetid,"none"); |
1005 |
} |
} |
1006 |
print "</td>"; |
print "</td>"; |
1007 |
} else { |
} |
1008 |
print '<td height="10"> </td><td colspan="3"> </td>'; |
else |
1009 |
|
{ |
1010 |
|
print '<td> </td><td colspan="3"> </td>'; |
1011 |
} |
} |
1012 |
|
|
1013 |
print '<td rowspan="8" colspan="2" valign="top">'; |
print '<td rowspan="8" colspan="2" valign="top">'; |
1065 |
|
|
1066 |
print "</td></tr>"; |
print "</td></tr>"; |
1067 |
|
|
1068 |
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>"; |
1069 |
|
|
1070 |
print '<tr><td height=\"10\">'.$langs->trans("GlobalDiscount").'</td>'; |
print '<tr><td>'.$langs->trans("GlobalDiscount").'</td>'; |
1071 |
if ($fac->brouillon == 1 && $user->rights->facture->creer) |
if ($fac->brouillon == 1 && $user->rights->facture->creer) |
1072 |
{ |
{ |
1073 |
print '<form action="facture.php?facid='.$fac->id.'" method="post">'; |
print '<form action="facture.php?facid='.$fac->id.'" method="post">'; |
1081 |
} |
} |
1082 |
print '</tr>'; |
print '</tr>'; |
1083 |
|
|
1084 |
print '<tr><td height=\"10\">'.$langs->trans("AmountHT").'</td>'; |
print '<tr><td>'.$langs->trans("AmountHT").'</td>'; |
1085 |
print '<td align="right" colspan="2"><b>'.price($fac->total_ht).'</b></td>'; |
print '<td align="right" colspan="2"><b>'.price($fac->total_ht).'</b></td>'; |
1086 |
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; |
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; |
1087 |
|
|
1088 |
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>'; |
1089 |
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; |
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; |
1090 |
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>'; |
1091 |
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; |
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; |
1092 |
|
|
1093 |
// Statut |
// Statut |
1094 |
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>'; |
1095 |
|
|
1096 |
if ($fac->note) |
if ($fac->note) |
1097 |
{ |
{ |