81 |
$commande->add_product($_POST["idprod2"],$_POST["qty2"],$_POST["remise_percent2"]); |
$commande->add_product($_POST["idprod2"],$_POST["qty2"],$_POST["remise_percent2"]); |
82 |
$commande->add_product($_POST["idprod3"],$_POST["qty3"],$_POST["remise_percent3"]); |
$commande->add_product($_POST["idprod3"],$_POST["qty3"],$_POST["remise_percent3"]); |
83 |
$commande->add_product($_POST["idprod4"],$_POST["qty4"],$_POST["remise_percent4"]); |
$commande->add_product($_POST["idprod4"],$_POST["qty4"],$_POST["remise_percent4"]); |
84 |
|
$commande->add_product($_POST["idprod5"],$_POST["qty5"],$_POST["remise_percent5"]); |
85 |
|
$commande->add_product($_POST["idprod6"],$_POST["qty6"],$_POST["remise_percent6"]); |
86 |
|
$commande->add_product($_POST["idprod7"],$_POST["qty7"],$_POST["remise_percent7"]); |
87 |
|
$commande->add_product($_POST["idprod8"],$_POST["qty8"],$_POST["remise_percent8"]); |
88 |
|
|
89 |
$commande_id = $commande->create($user); |
$commande_id = $commande->create($user); |
90 |
|
|
93 |
$action = ''; |
$action = ''; |
94 |
} |
} |
95 |
|
|
|
/* |
|
|
* |
|
|
*/ |
|
|
|
|
96 |
if ($_POST["action"] == 'setremise' && $user->rights->commande->creer) |
if ($_POST["action"] == 'setremise' && $user->rights->commande->creer) |
97 |
{ |
{ |
98 |
$commande = new Commande($db); |
$commande = new Commande($db); |
113 |
/* |
/* |
114 |
* Ajout d'une ligne produit dans la commande |
* Ajout d'une ligne produit dans la commande |
115 |
*/ |
*/ |
116 |
$commande = new Commande($db); |
if ($_POST["qty"] && (($_POST["pu"] && $_POST["desc"]) || $_POST["p_idprod"])) |
|
$ret=$commande->fetch($_POST["id"]); |
|
|
|
|
|
if (isset($_POST["p_idprod"])) |
|
117 |
{ |
{ |
118 |
$result = $commande->addline( |
$commande = new Commande($db); |
119 |
$_POST["np_desc"], |
$ret=$commande->fetch($_POST["id"]); |
120 |
$_POST["pu"], |
|
121 |
$_POST["pqty"], |
if (isset($_POST["p_idprod"])) |
122 |
$_POST["tva_tx"], |
{ |
123 |
$_POST["p_idprod"], |
$result = $commande->addline( |
124 |
$_POST["premise"]); |
$_POST["np_desc"], |
125 |
} |
$_POST["pu"], |
126 |
else |
$_POST["qty"], |
127 |
{ |
$_POST["tva_tx"], |
128 |
$result = $commande->addline( |
$_POST["p_idprod"], |
129 |
$_POST["desc"], |
$_POST["remise_percent"]); |
130 |
$_POST["pu"], |
} |
131 |
$_POST["qty"], |
else |
132 |
$_POST["tva_tx"], |
{ |
133 |
0, |
$result = $commande->addline( |
134 |
$_POST["remise_percent"]); |
$_POST["desc"], |
135 |
|
$_POST["pu"], |
136 |
|
$_POST["qty"], |
137 |
|
$_POST["tva_tx"], |
138 |
|
0, |
139 |
|
$_POST["remise_percent"]); |
140 |
|
} |
141 |
} |
} |
|
|
|
142 |
} |
} |
143 |
|
|
144 |
if ($_POST["action"] == 'updateligne' && $user->rights->commande->creer) |
if ($_POST["action"] == 'updateligne' && $user->rights->commande->creer && $_POST["save"] == $langs->trans("Save")) |
145 |
{ |
{ |
146 |
$commande = new Commande($db,"",$_GET["id"]); |
$commande = new Commande($db,"",$_POST["id"]); |
147 |
if ($commande->fetch($_GET["id"]) ) |
if (! $commande->fetch($_POST["id"]) > 0) dolibarr_print_error($db); |
148 |
{ |
|
149 |
$result = $commande->update_line($_POST["elrowid"], |
$result = $commande->update_line($_POST["elrowid"], |
150 |
$_POST["eldesc"], |
$_POST["eldesc"], |
151 |
$_POST["elprice"], |
$_POST["elprice"], |
152 |
$_POST["elqty"], |
$_POST["elqty"], |
153 |
$_POST["elremise_percent"]); |
$_POST["elremise_percent"], |
154 |
} |
$_POST["eltva_tx"] |
155 |
else |
); |
156 |
{ |
|
157 |
print "Erreur"; |
$_GET["id"]=$_POST["id"]; // Pour réaffichage de la fiche en cours d'édition |
158 |
} |
} |
159 |
|
|
160 |
|
if ($_POST["action"] == 'updateligne' && $user->rights->commande->creer && $_POST["cancel"] == $langs->trans("Cancel")) |
161 |
|
{ |
162 |
|
Header("Location: fiche.php?id=".$_POST["id"]); // Pour réaffichage de la fiche en cours d'édition |
163 |
|
exit; |
164 |
} |
} |
165 |
|
|
166 |
if ($_GET["action"] == 'deleteline' && $user->rights->commande->creer) |
if ($_GET["action"] == 'deleteline' && $user->rights->commande->creer) |
333 |
/* |
/* |
334 |
* |
* |
335 |
*/ |
*/ |
336 |
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>'; |
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("CreateDraft").'"></td></tr>'; |
337 |
print "</form>\n"; |
print "</form>\n"; |
338 |
print "</table>\n"; |
print "</table>\n"; |
339 |
|
|
613 |
print '<td align="right" width="50">'.$langs->trans('VAT').'</td>'; |
print '<td align="right" width="50">'.$langs->trans('VAT').'</td>'; |
614 |
print '<td align="right" width="80">'.$langs->trans('PriceUHT').'</td>'; |
print '<td align="right" width="80">'.$langs->trans('PriceUHT').'</td>'; |
615 |
print '<td align="right" width="50">'.$langs->trans('Qty').'</td>'; |
print '<td align="right" width="50">'.$langs->trans('Qty').'</td>'; |
616 |
print '<td align="right">'.$langs->trans('Discount').'</td>'; |
print '<td align="right" width="50">'.$langs->trans('Discount').'</td>'; |
617 |
print '<td align="right">'.$langs->trans('AmountHT').'</td>'; |
print '<td align="right" width="50">'.$langs->trans('AmountHT').'</td>'; |
618 |
print '<td> </td><td> </td>'; |
print '<td> </td><td> </td>'; |
619 |
print "</tr>\n"; |
print "</tr>\n"; |
620 |
} |
} |
624 |
$objp = $db->fetch_object($resql); |
$objp = $db->fetch_object($resql); |
625 |
$var=!$var; |
$var=!$var; |
626 |
|
|
627 |
// Affiche ligne de commande en mode non edit |
// Ligne en mode visu |
628 |
if ($_GET['action'] != 'editline' || $_GET['rowid'] != $objp->rowid) |
if ($_GET['action'] != 'editline' || $_GET['rowid'] != $objp->rowid) |
629 |
{ |
{ |
630 |
print '<tr '.$bc[$var].'>'; |
print '<tr '.$bc[$var].'>'; |
643 |
print "</td>\n"; |
print "</td>\n"; |
644 |
} |
} |
645 |
print '<td align="right">'.$objp->tva_tx.'%</td>'; |
print '<td align="right">'.$objp->tva_tx.'%</td>'; |
|
|
|
646 |
print '<td align="right">'.price($objp->subprice)."</td>\n"; |
print '<td align="right">'.price($objp->subprice)."</td>\n"; |
|
|
|
647 |
print '<td align="right">'.$objp->qty.'</td>'; |
print '<td align="right">'.$objp->qty.'</td>'; |
|
|
|
648 |
if ($objp->remise_percent > 0) |
if ($objp->remise_percent > 0) |
649 |
{ |
{ |
650 |
print '<td align="right">'.$objp->remise_percent."%</td>\n"; |
print '<td align="right">'.$objp->remise_percent."%</td>\n"; |
672 |
print '</tr>'; |
print '</tr>'; |
673 |
} |
} |
674 |
|
|
675 |
// Affiche ligne de commande en mode non edit |
// Ligne en mode update |
676 |
if ($_GET["action"] == 'editline' && $_GET["rowid"] == $objp->rowid) |
if ($_GET["action"] == 'editline' && $user->rights->commande->creer && $_GET["rowid"] == $objp->rowid) |
677 |
{ |
{ |
678 |
print "<form action=\"fiche.php?id=$id\" method=\"post\">"; |
print '<form action="fiche.php" method="post">'; |
679 |
print '<input type="hidden" name="action" value="updateligne">'; |
print '<input type="hidden" name="action" value="updateligne">'; |
680 |
|
print '<input type="hidden" name="id" value="'.$id.'">'; |
681 |
print '<input type="hidden" name="elrowid" value="'.$_GET["rowid"].'">'; |
print '<input type="hidden" name="elrowid" value="'.$_GET["rowid"].'">'; |
682 |
print "<tr $bc[$var]>"; |
print '<tr '.$bc[$var].'>'; |
683 |
print '<td>'; |
print '<td>'; |
684 |
if ($objp->fk_product > 0) |
if ($objp->fk_product > 0) |
685 |
{ |
{ |
692 |
} |
} |
693 |
print '<textarea name="eldesc" cols="50" rows="1">'.stripslashes($objp->description).'</textarea></td>'; |
print '<textarea name="eldesc" cols="50" rows="1">'.stripslashes($objp->description).'</textarea></td>'; |
694 |
print '<td align="right">'; |
print '<td align="right">'; |
695 |
//print $html->select_tva("tva_tx",$objp->tva_taux); |
print $html->select_tva("eltva_tx",$objp->tva_tx); |
|
print $objp->tva_tx."%"; // Taux tva dépend du produit, donc on ne doit pas pouvoir le changer ici |
|
696 |
print '</td>'; |
print '</td>'; |
697 |
print '<td align="right"><input size="5" type="text" class="flat" name="elprice" value="'.price($objp->subprice).'"></td>'; |
print '<td align="right"><input size="5" type="text" class="flat" name="elprice" value="'.price($objp->subprice).'"></td>'; |
698 |
print '<td align="right"><input size="2" type="text" class="flat" name="elqty" value="'.$objp->qty.'"></td>'; |
print '<td align="right"><input size="2" type="text" class="flat" name="elqty" value="'.$objp->qty.'"></td>'; |
699 |
print '<td align="right" nowrap><input size="1" type="text" class="flat" name="elremise_percent" value="'.$objp->remise_percent.'">%</td>'; |
print '<td align="right" nowrap><input size="1" type="text" class="flat" name="elremise_percent" value="'.$objp->remise_percent.'">%</td>'; |
700 |
print '<td align="center" colspan="3"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td>'; |
print '<td align="center" colspan="3"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">'; |
701 |
|
print '<br /><input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td>'; |
702 |
print '</tr>'; |
print '</tr>'; |
703 |
print '</form>'; |
print '</form>'; |
704 |
} |
} |
761 |
print '<textarea cols="50" name="np_desc" rows="1"></textarea>'; |
print '<textarea cols="50" name="np_desc" rows="1"></textarea>'; |
762 |
print '</td>'; |
print '</td>'; |
763 |
print '<td> </td>'; |
print '<td> </td>'; |
764 |
print '<td align="right"><input type="text" size="2" name="pqty" value="1"></td>'; |
print '<td align="right"><input type="text" size="2" name="qty" value="1"></td>'; |
765 |
print '<td align="right" nowrap><input type="text" size="2" name="premise" value="0">%</td>'; |
print '<td align="right" nowrap><input type="text" size="2" name="remise_percent" value="0">%</td>'; |
766 |
print '<td align="center" colspan="3"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td></tr>'; |
print '<td align="center" colspan="3"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td></tr>'; |
767 |
print "</tr>\n"; |
print "</tr>\n"; |
768 |
|
|