stockcorrection.tpl.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. /* Copyright (C) 2010-2015 Laurent Destailleur <eldy@users.sourceforge.net>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. *
  17. * $object must be defined
  18. */
  19. ?>
  20. <!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP -->
  21. <?php
  22. $productref = '';
  23. if ($object->element == 'product') $productref = $object->ref;
  24. $langs->load("productbatch");
  25. if (empty($id)) $id = $object->id;
  26. print '<script type="text/javascript" language="javascript">
  27. jQuery(document).ready(function() {
  28. function init_price()
  29. {
  30. if (jQuery("#mouvement").val() == \'0\') jQuery("#unitprice").removeAttr("disabled");
  31. else jQuery("#unitprice").prop("disabled", true);
  32. }
  33. init_price();
  34. jQuery("#mouvement").change(function() {
  35. init_price();
  36. });
  37. });
  38. </script>';
  39. print load_fiche_titre($langs->trans("StockCorrection"),'','title_generic.png');
  40. print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">'."\n";
  41. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  42. print '<input type="hidden" name="action" value="correct_stock">';
  43. print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
  44. print '<table class="border" width="100%">';
  45. // Warehouse or product
  46. print '<tr>';
  47. if ($object->element == 'product')
  48. {
  49. print '<td width="20%" class="fieldrequired" colspan="2">'.$langs->trans("Warehouse").'</td>';
  50. print '<td width="20%">';
  51. print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')), 'id_entrepot', '', 1);
  52. print '</td>';
  53. }
  54. if ($object->element == 'stock')
  55. {
  56. print '<td width="20%" class="fieldrequired" colspan="2">'.$langs->trans("Product").'</td>';
  57. print '<td width="20%">';
  58. print $form->select_produits(GETPOST('product_id'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''), 20, 0, -1);
  59. print '</td>';
  60. }
  61. print '<td width="20%">';
  62. print '<select name="mouvement" id="mouvement" class="flat">';
  63. print '<option value="0">'.$langs->trans("Add").'</option>';
  64. print '<option value="1"'.(GETPOST('mouvement')?' selected="selected"':'').'>'.$langs->trans("Delete").'</option>';
  65. print '</select></td>';
  66. print '<td width="20%" class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td><td width="20%"><input class="flat" name="nbpiece" id="nbpiece" size="10" value="'.GETPOST("nbpiece").'"></td>';
  67. print '</tr>';
  68. // Purchase price
  69. print '<tr>';
  70. print '<td width="20%" colspan="2">'.$langs->trans("UnitPurchaseValue").'</td>';
  71. print '<td colspan="4"><input class="flat" name="unitprice" id="unitprice" size="10" value="'.GETPOST("unitprice").'"></td>';
  72. print '</tr>';
  73. // Serial / Eat-by date
  74. if (! empty($conf->productbatch->enabled) &&
  75. (($object->element == 'product' && $object->hasbatch())
  76. || ($object->element == 'stock'))
  77. )
  78. {
  79. print '<tr>';
  80. print '<td colspan="2"'.($object->element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="4">';
  81. print '<input type="text" name="batch_number" size="40" value="'.GETPOST("batch_number").'">';
  82. print '</td>';
  83. print '</tr><tr>';
  84. print '<td colspan="2">'.$langs->trans("l_eatby").'</td><td>';
  85. $eatbyselected=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear'));
  86. $form->select_date($eatbyselected,'eatby','','',1,"");
  87. print '</td>';
  88. print '<td></td>';
  89. print '<td>'.$langs->trans("l_sellby").'</td><td>';
  90. $sellbyselected=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear'));
  91. $form->select_date($sellbyselected,'sellby','','',1,"");
  92. print '</td>';
  93. print '</tr>';
  94. }
  95. // Label of mouvement of id of inventory
  96. $valformovementlabel=((GETPOST("label") && (GETPOST('label') != $langs->trans("MovementCorrectStock",''))) ? GETPOST("label") : $langs->trans("MovementCorrectStock", $productref));
  97. print '<tr>';
  98. print '<td width="20%" colspan="2">'.$langs->trans("MovementLabel").'</td>';
  99. print '<td colspan="2">';
  100. print '<input type="text" name="label" size="60" value="'.$valformovementlabel.'">';
  101. print '</td>';
  102. print '<td width="20%">'.$langs->trans("InventoryCode").'</td><td width="20%"><input class="flat" name="inventorycode" id="inventorycode" size="14" value="'.GETPOST("inventorycode").'"></td>';
  103. print '</tr>';
  104. print '</table>';
  105. print '<div class="center">';
  106. print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans('Save')).'">';
  107. print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
  108. print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
  109. print '</div>';
  110. print '</form>';
  111. ?>
  112. <!-- END PHP STOCKCORRECTION.TPL.PHP -->