init_price();
			jQuery("#mouvement").change(function() {
				init_price();
			});
		});
		</script>';
        print_titre($langs->trans("StockCorrection"));
        print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $product->id . '" method="post">' . "\n";
        print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
        print '<input type="hidden" name="action" value="correct_stock">';
        print '<table class="border" width="100%">';
        // Warehouse
        print '<tr>';
        print '<td width="20%" class="fieldrequired" colspan="2">' . $langs->trans("Warehouse") . '</td>';
        print '<td width="20%">';
        print $formproduct->selectWarehouses($_GET["dwid"] ? $_GET["dwid"] : GETPOST('id_entrepot'), 'id_entrepot', '', 1);
        print '</td>';
        print '<td width="20%">';
        print '<select name="mouvement" id="mouvement" class="flat">';
        print '<option value="0">' . $langs->trans("Add") . '</option>';
        print '<option value="1">' . $langs->trans("Delete") . '</option>';
        print '</select></td>';
        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>';
        print '</tr>';
        // Label
        print '<tr>';
        print '<td width="20%" colspan="2">' . $langs->trans("Label") . '</td>';
        print '<td colspan="2">';
        print '<input type="text" name="label" size="40" value="' . GETPOST("label") . '">';
        print '</td>';
        print '<td width="20%">' . $langs->trans("UnitPurchaseValue") . '</td><td width="20%"><input class="flat" name="price" id="unitprice" size="10" value="' . GETPOST("unitprice") . '"></td>';
示例#2
0
                     print '<input name="fk_commandefourndet' . $suffix . '" type="hidden" value="' . $objp->rowid . '">';
                     print '<input name="product' . $suffix . '" type="hidden" value="' . $objp->fk_product . '">';
                     print '<input name="pu' . $suffix . '" type="hidden" value="' . $up_ht_disc . '"><!-- This is a up including discount -->';
                     // hidden fields for js function
                     print '<input id="qty_ordered' . $suffix . '" type="hidden" value="' . $objp->qty . '">';
                     print '<input id="qty_dispatched' . $suffix . '" type="hidden" value="' . (double) $products_dispatched[$objp->rowid] . '">';
                     print '</td>';
                 }
                 // Dispatch
                 print '<td align="right">';
                 print '<input id="qty' . $suffix . '" name="qty' . $suffix . '" type="text" size="8" value="' . (GETPOST('qty' . $suffix) != '' ? GETPOST('qty' . $suffix) : $remaintodispatch) . '">';
                 print '</td>';
                 // Warehouse
                 print '<td align="right">';
                 if (count($listwarehouses) > 1) {
                     print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix), "entrepot" . $suffix, '', 1, 0, $objp->fk_product);
                 } elseif (count($listwarehouses) == 1) {
                     print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix), "entrepot" . $suffix, '', 0, 0, $objp->fk_product);
                 } else {
                     print $langs->trans("NoWarehouseDefined");
                 }
                 print "</td>\n";
                 print "</tr>\n";
             }
         }
         $i++;
     }
     $db->free($resql);
 } else {
     dol_print_error($db);
 }
示例#3
0
	/*
	 * Correct stock
	 */
	if ($action == "correction")
	{
		print_titre($langs->trans("StockCorrection"));
		print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'" method="post">'."\n";
		print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
		print '<input type="hidden" name="action" value="correct_stock">';
		print '<table class="border" width="100%">';

		// Warehouse
		print '<tr>';
		print '<td width="20%">'.$langs->trans("Warehouse").'</td>';
		print '<td width="20%">';
		print $formproduct->selectWarehouses($_GET["dwid"],'id_entrepot','',1);
		print '</td>';
		print '<td width="20%">';
		print '<select name="mouvement" class="flat">';
		print '<option value="0">'.$langs->trans("Add").'</option>';
		print '<option value="1">'.$langs->trans("Delete").'</option>';
		print '</select></td>';
		print '<td width="20%">'.$langs->trans("NumberOfUnit").'</td><td width="20%"><input class="flat" name="nbpiece" size="10" value=""></td>';
		print '</tr>';

		// Label
		print '<tr>';
		print '<td width="20%">'.$langs->trans("Label").'</td>';
		print '<td colspan="4">';
		print '<input type="text" name="label" size="40" value="">';
		print '</td>';
			init_price();
			jQuery("#mouvement").change(function() {
				init_price();
			});
		});
		</script>';
        print_titre($langs->trans("StockCorrection"));
        print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $product->id . '" method="post">' . "\n";
        print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
        print '<input type="hidden" name="action" value="correct_stock">';
        print '<table class="border" width="100%">';
        // Warehouse
        print '<tr>';
        print '<td width="20%" class="fieldrequired" colspan="2">' . $langs->trans("Warehouse") . '</td>';
        print '<td width="20%">';
        print $formproduct->selectWarehouses(GETPOST("dwid") ? GETPOST("dwid", 'int') : (GETPOST('id_entrepot') ? GETPOST('id_entrepot', 'int') : 'ifone'), 'id_entrepot', '', 1);
        print '</td>';
        print '<td width="20%">';
        print '<select name="mouvement" id="mouvement" class="flat">';
        print '<option value="0">' . $langs->trans("Add") . '</option>';
        print '<option value="1">' . $langs->trans("Delete") . '</option>';
        print '</select></td>';
        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>';
        print '</tr>';
        // Label
        print '<tr>';
        print '<td width="20%" colspan="2">' . $langs->trans("Label") . '</td>';
        print '<td colspan="2">';
        print '<input type="text" name="label" size="40" value="' . GETPOST("label") . '">';
        print '</td>';
        print '<td width="20%">' . $langs->trans("UnitPurchaseValue") . '</td><td width="20%"><input class="flat" name="price" id="unitprice" size="10" value="' . GETPOST("unitprice") . '"></td>';
示例#5
0
       	$notify=new Notify($db);
       	$text.='<br>';
       	$text.=$notify->confirmMessage('BILL_SUPPLIER_VALIDATE',$object->socid, $object);
       }*/
     $formquestion = array();
     $qualified_for_stock_change = 0;
     if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
         $qualified_for_stock_change = $object->hasProductsOrServices(2);
     } else {
         $qualified_for_stock_change = $object->hasProductsOrServices(1);
     }
     if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change) {
         $langs->load("stocks");
         require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
         $formproduct = new FormProduct($db);
         $formquestion = array(array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockIncrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'), 'idwarehouse', '', 1)));
     }
     $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ValidateBill'), $text, 'confirm_valid', $formquestion, 1, 1, 240);
 }
 // Confirmation set paid
 if ($action == 'paid') {
     $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidBill', $object->ref), 'confirm_paid', '', 0, 1);
 }
 // Confirmation de la suppression de la facture fournisseur
 if ($action == 'delete') {
     $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete', '', 0, 1);
 }
 // Confirmation to delete line
 if ($action == 'ask_deleteline') {
     $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1);
 }
示例#6
0
     print '<input name="idl' . $indiceAsked . '" type="hidden" value="' . $line->id . '">';
     print '<input name="qtyl' . $indiceAsked . '" id="qtyl' . $indiceAsked . '" type="text" size="4" value="' . $deliverableQty . '">';
 } else {
     print $langs->trans("NA");
 }
 print '</td>';
 // Stock
 if (!empty($conf->stock->enabled)) {
     print '<td align="left">';
     if ($line->product_type == 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
         // Show warehouse combo list
         $ent = "entl" . $indiceAsked;
         $idl = "idl" . $indiceAsked;
         $tmpentrepot_id = is_numeric(GETPOST($ent, 'int')) ? GETPOST($ent, 'int') : $warehouse_id;
         if ($line->fk_product > 0) {
             print $formproduct->selectWarehouses($tmpentrepot_id, 'entl' . $indiceAsked, '', 1, 0, $line->fk_product);
             if ($tmpentrepot_id > 0 && $tmpentrepot_id == $warehouse_id) {
                 //print $stock.' '.$quantityToBeDelivered;
                 if ($stock < $quantityToBeDelivered) {
                     print ' ' . img_warning($langs->trans("StockTooLow"));
                     // Stock too low for this $warehouse_id but you can change warehouse
                 }
             }
         }
     } else {
         print $langs->trans("Service");
     }
     print '</td>';
 }
 print "</tr>\n";
 // Show subproducts of product
示例#7
0
$langs->load("companies");
if (! empty($conf->global->CASHDESK_ID_THIRDPARTY)) $disabled=1; // If a particular third party is defined, we disable choice
$form->select_societes(GETPOST('socid')?GETPOST('socid'):$conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3)',!$disabled,$disabled,1);
//print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
print '</td>';
print "</tr>\n";

if ($conf->stock->enabled)
{
	$langs->load("stocks");
	print "<tr>";
	print '<td class="label1">'.$langs->trans("Warehouse").'</td>';
	print '<td>';
	$disabled=0;
	if (! empty($conf->global->CASHDESK_ID_WAREHOUSE)) $disabled=1;	// If a particular stock is defined, we disable choice
	$formproduct->selectWarehouses(GETPOST('warehouseid')?GETPOST('warehouseid'):$conf->global->CASHDESK_ID_WAREHOUSE,'warehouseid','',!$disabled,$disabled);
	//print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
	print '</td>';
	print "</tr>\n";
}
?>
</table>

<center><span class="bouton_login"><input name="sbmtConnexion" type="submit" value=<?php echo $langs->trans("Connection"); ?> /></span></center>

</form>
</fieldset>

<?php
if ($_GET['err'] < 0) {
// If a particular third party is defined, we disable choice
print $form->select_company(GETPOST('socid', 'int') ? GETPOST('socid', 'int') : $conf->global->CASHDESK_ID_THIRDPARTY, 'socid', 's.client in (1,3)', !$disabled, $disabled, 1);
//print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
print '</td>';
print "</tr>\n";
if (!empty($conf->stock->enabled)) {
    $langs->load("stocks");
    print "<tr>";
    print '<td class="label1">' . $langs->trans("Warehouse") . '</td>';
    print '<td>';
    $disabled = 0;
    if (!empty($conf->global->CASHDESK_ID_WAREHOUSE)) {
        $disabled = 1;
    }
    // If a particular stock is defined, we disable choice
    print $formproduct->selectWarehouses(GETPOST('warehouseid') ? GETPOST('warehouseid') : (empty($conf->global->CASHDESK_ID_WAREHOUSE) ? 'ifone' : $conf->global->CASHDESK_ID_WAREHOUSE), 'warehouseid', '', !$disabled, $disabled);
    //print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
    print '</td>';
    print "</tr>\n";
}
print "<tr>";
print '<td class="label1">' . $langs->trans("CashDeskBankAccountForSell") . '</td>';
print '<td>';
$defaultknown = 0;
if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH) && $conf->global->CASHDESK_ID_BANKACCOUNT_CASH > 0) {
    $defaultknown = 1;
}
// If a particular stock is defined, we disable choice
print $form->select_comptes(GETPOST('bankid_cash') > 0 ? GETPOST('bankid_cash') : $conf->global->CASHDESK_ID_BANKACCOUNT_CASH, 'CASHDESK_ID_BANKACCOUNT_CASH', 0, "courant=2", $defaultknown ? 0 : 2);
print '</td>';
print "</tr>\n";
print '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="set_GRAPEFRUIT_SHIPPING_CREATE_FROM_ORDER_WHERE_BILL_PAID">';
echo ajax_constantonoff('GRAPEFRUIT_SHIPPING_CREATE_FROM_ORDER_WHERE_BILL_PAID');
print '</form>';
print '</td></tr>';
$formProduct = new FormProduct($db);
$var = !$var;
print '<tr ' . $bc[$var] . '>';
print '<td>' . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $langs->trans("set_GRAPEFRUIT_SHIPPING_CREATE_FROM_ORDER_WHERE_BILL_PAID_WAREHOUSE") . '</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="300">';
print '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="set_GRAPEFRUIT_SHIPPING_CREATE_FROM_ORDER_WHERE_BILL_PAID_WAREHOUSE">';
echo $formProduct->selectWarehouses($conf->global->GRAPEFRUIT_SHIPPING_CREATE_FROM_ORDER_WHERE_BILL_PAID_WAREHOUSE, 'GRAPEFRUIT_SHIPPING_CREATE_FROM_ORDER_WHERE_BILL_PAID_WAREHOUSE', '', 1);
print '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">';
print '</form>';
print '</td></tr>';
$var = !$var;
print '<tr ' . $bc[$var] . '>';
print '<td>' . $langs->trans("set_GRAPEFRUIT_SET_ORDER_SHIPPED_IF_ALL_PRODUCT_SHIPPED") . '</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="300">';
print '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="set_GRAPEFRUIT_SET_ORDER_SHIPPED_IF_ALL_PRODUCT_SHIPPED">';
echo ajax_constantonoff('GRAPEFRUIT_SET_ORDER_SHIPPED_IF_ALL_PRODUCT_SHIPPED');
print '</form>';
print '</td></tr>';
print '<tr class="liste_titre">';
示例#10
0
     }
     if ($object->type != 2 && $object->total_ttc < 0) {
         $text .= '<br>' . img_warning() . ' ' . $langs->trans("ErrorInvoiceOfThisTypeMustBePositive");
     }
     $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?facid=' . $object->id, $langs->trans('ValidateBill'), $text, 'confirm_valid', $formquestion, $object->type != 2 && $object->total_ttc < 0 ? "no" : "yes", $conf->notification->enabled ? 0 : 2);
 }
 // Confirm back to draft status
 if ($action == 'modif') {
     $text = $langs->trans('ConfirmUnvalidateBill', $object->ref);
     $formquestion = array();
     if ($object->type != 3 && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $object->hasProductsOrServices(1)) {
         $langs->load("stocks");
         require_once DOL_DOCUMENT_ROOT . "/product/class/html.formproduct.class.php";
         $formproduct = new FormProduct($db);
         $label = $object->type == 2 ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease");
         $formquestion = array(array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'), 'idwarehouse', '', 1)));
     }
     $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?facid=' . $object->id, $langs->trans('UnvalidateBill'), $text, 'confirm_modif', $formquestion, "yes", 1);
 }
 // Confirmation du classement paye
 if ($action == 'paid' && $resteapayer <= 0) {
     $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?facid=' . $object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidBill', $object->ref), 'confirm_paid', '', "yes", 1);
 }
 if ($action == 'paid' && $resteapayer > 0) {
     // Code
     $i = 0;
     $close[$i]['code'] = 'discount_vat';
     $i++;
     $close[$i]['code'] = 'badcustomer';
     $i++;
     // Help
function showParameters(&$form)
{
    global $db, $conf, $langs;
    dol_include_once('/product/class/html.formproduct.class.php');
    $formProduct = new FormProduct($db);
    ?>
<form action="<?php 
    echo $_SERVER['PHP_SELF'];
    ?>
" name="load-<?php 
    echo $typeDoc;
    ?>
" method="POST" enctype="multipart/form-data">
		<input type="hidden" name="action" value="save" />
		<table width="100%" class="noborder">
			<tr class="liste_titre">
				<td colspan="2"><?php 
    echo $langs->trans('ParametersWarehouse');
    ?>
</td>
			</tr>
			
			<tr class="pair">
				<td><?php 
    echo $langs->trans('UseManualWarehouse');
    ?>
</td><td><?php 
    echo ajax_constantonoff('ASSET_MANUAL_WAREHOUSE');
    ?>
</td>
			</tr> 
			
			<tr id="USE_DEFAULT_WAREHOUSE" class="impair">
				<td><?php 
    echo $langs->trans('UseDefinedWarehouse');
    ?>
</td><td><?php 
    echo ajax_constantonoff('ASSET_USE_DEFAULT_WAREHOUSE', array('showhide' => array('#WAREHOUSE_TO_MAKE', '#WAREHOUSE_NEEDED'), 'hide' => array('#WAREHOUSE_TO_MAKE', '#WAREHOUSE_NEEDED')));
    ?>
</td>
			</tr> 
			
			<tr class="pair" id="WAREHOUSE_TO_MAKE" class="pair" <?php 
    if (empty($conf->global->ASSET_USE_DEFAULT_WAREHOUSE)) {
        echo "style='display:none;'";
    }
    ?>
>
				<td><?php 
    echo $langs->trans('DefaultWarehouseIdToMake');
    ?>
</td><td><?php 
    echo $formProduct->selectWarehouses($conf->global->ASSET_DEFAULT_WAREHOUSE_ID_TO_MAKE, 'TOF[ASSET_DEFAULT_WAREHOUSE_ID_TO_MAKE]');
    ?>
</td>
			</tr>
			
			<tr class="impair" id="WAREHOUSE_NEEDED" <?php 
    if (empty($conf->global->ASSET_USE_DEFAULT_WAREHOUSE)) {
        echo "style='display:none;'";
    }
    ?>
>
				<td><?php 
    echo $langs->trans('DefaultWarehouseIdNeeded');
    ?>
</td><td><?php 
    echo $formProduct->selectWarehouses($conf->global->ASSET_DEFAULT_WAREHOUSE_ID_NEEDED, 'TOF[ASSET_DEFAULT_WAREHOUSE_ID_NEEDED]');
    ?>
</td>
			</tr> 
			<tr class="liste_titre">
				<td colspan="2"><?php 
    echo $langs->trans('TemplateOF');
    ?>
</td>
			</tr>
			<tr class="pair" >
				<td><?php 
    echo $langs->trans('Template');
    ?>
</td><td>
					<input type="file" name="template" />
					<?php 
    echo ' <a href="' . dol_buildpath('/of/exempleTemplate/templateOF.odt', 1) . '">' . $langs->trans('Download') . '</a>';
    ?>
</td>
			</tr> 
			
			
		</table>
		
		<script type="text/javascript">
			$(function() {
				$('#set_ASSET_MANUAL_WAREHOUSE').click(function() {
					if ($('#del_ASSET_USE_DEFAULT_WAREHOUSE').css('display') != 'none') {
						$('#del_ASSET_USE_DEFAULT_WAREHOUSE').click();
					}
				});
				
				$('#set_ASSET_USE_DEFAULT_WAREHOUSE').click(function() {
					if ($('#del_ASSET_MANUAL_WAREHOUSE').css('display') != 'none') {
						$('#del_ASSET_MANUAL_WAREHOUSE').click();
					}
				});
			});
		</script>
		
		<p align="right">	
			<input class="button" type="submit" name="bt_save" value="<?php 
    echo $langs->trans('Save');
    ?>
" /> 
		</p>
	
	</form>
	<p align="center" style="background: #fff;">
	   
	   <a href="http://www.atm-consulting.fr/" target="_blank"><img src="../img/ATM_logo.jpg" /></a>
	</p>
	
	<br /><br />
	<?php 
}
function _fiche_ligne(&$form, &$of, $type)
{
    global $db, $conf, $langs, $hookmanager;
    //TODO rules guys ! To Facto ! AA
    $formProduct = new FormProduct($db);
    $PDOdb = new TPDOdb();
    $TRes = array();
    foreach ($of->TAssetOFLine as $k => &$TAssetOFLine) {
        $product =& $TAssetOFLine->product;
        if (is_null($product)) {
            $product = new Product($db);
            $product->fetch($TAssetOFLine->fk_product);
            $product->fetch_optionals();
        }
        $conditionnement = $TAssetOFLine->conditionnement;
        if (!empty($conf->asset->enabled)) {
            $TAssetType = new TAsset_type();
            $TAssetType->load($PDOdb, $product->array_options['options_type_asset']);
            $conditionnement_unit = $TAssetType->measuring_units == 'unit' || $TAssetType->gestion_stock == 'UNIT' ? 'unité(s)' : $TAssetOFLine->libUnite();
        } else {
            $conditionnement_unit = 'unité(s)';
            // TODO translate
        }
        //$conditionnement_unit = $TAssetOFLine->libUnite();
        if ($TAssetOFLine->measuring_units != 'unit' && !empty($TAssetOFLine->measuring_units)) {
            $conditionnement_label = ' / ' . $conditionnement . " " . $conditionnement_unit;
            $conditionnement_label_edit = ' par ' . $form->texte('', 'TAssetOFLine[' . $k . '][conditionnement]', $conditionnement, 5, 5, '', '') . $conditionnement_unit;
        } else {
            $conditionnement_label = $conditionnement_label_edit = '';
        }
        if ($TAssetOFLine->type == "NEEDED" && $type == "NEEDED") {
            $stock_needed = TAssetOF::getProductStock($product->id);
            $TLine = array('id' => $TAssetOFLine->getId(), 'idprod' => $form->hidden('TAssetOFLine[' . $k . '][fk_product]', $product->id), 'lot_number' => $of->status == 'DRAFT' ? $form->texte('', 'TAssetOFLine[' . $k . '][lot_number]', $TAssetOFLine->lot_number, 15, 50, 'type_product="NEEDED" fk_product="' . $product->id . '" rel="lot-' . $TAssetOFLine->getId() . '" ', 'TAssetOFLineLot') : $TAssetOFLine->lot_number, 'libelle' => $product->getNomUrl(1) . ' ' . $product->label . ' - ' . ($stock_needed > 0 ? $langs->trans("Stock") . " : " . $stock_needed : '<span style="color:red;font-weight:bold;">' . $langs->trans("Stock") . " : " . $stock_needed . '</span>') . _fiche_ligne_asset($PDOdb, $form, $of, $TAssetOFLine, 'NEEDED'), 'qty_needed' => $TAssetOFLine->qty_needed . $conditionnement_label, 'qty' => $of->status == 'DRAFT' ? $form->texte('', 'TAssetOFLine[' . $k . '][qty]', $TAssetOFLine->qty, 5, 50) : $TAssetOFLine->qty, 'qty_used' => $of->status == 'OPEN' || $of->status == 'CLOSE' ? $form->texte('', 'TAssetOFLine[' . $k . '][qty_used]', $TAssetOFLine->qty_used, 5, 50) : $TAssetOFLine->qty_used, 'qty_toadd' => $TAssetOFLine->qty - $TAssetOFLine->qty_used, 'workstations' => $conf->workstation->enabled ? $TAssetOFLine->visu_checkbox_workstation($db, $of, $form, 'TAssetOFLine[' . $k . '][fk_workstation][]') : '', 'delete' => $form->type_aff == 'edit' && ($of->status == 'DRAFT' || !empty($conf->global->OF_USE_DESTOCKAGE_PARTIEL) && $of->status != 'CLOSE' && empty($TAssetOFLine->qty_used)) ? '<a href="javascript:deleteLine(' . $TAssetOFLine->getId() . ',\'NEEDED\');">' . img_picto('Supprimer', 'delete.png') . '</a>' : '', 'fk_entrepot' => !empty($conf->global->ASSET_MANUAL_WAREHOUSE) && ($of->status == 'DRAFT' || $of->status == 'VALID') && $form->type_aff == 'edit' ? $formProduct->selectWarehouses($TAssetOFLine->fk_entrepot, 'TAssetOFLine[' . $k . '][fk_entrepot]', '', 0, 0, $TAssetOFLine->fk_product) : $TAssetOFLine->getLibelleEntrepot($PDOdb), 'note_private' => $of->status == 'DRAFT' ? $form->zonetexte('', 'TAssetOFLine[' . $k . '][note_private]', $TAssetOFLine->note_private, 50, 1) : $TAssetOFLine->note_private);
            $action = $form->type_aff;
            $parameter = array('of' => &$of, 'line' => &$TLine, 'type' => 'NEEDED');
            $res = $hookmanager->executeHooks('lineObjectOptions', $parameter, $TAssetOFLine, $action);
            if ($res > 0 && !empty($hookmanager->resArray)) {
                $TLine = $hookmanager->resArray;
            }
            $TRes[] = $TLine;
        } elseif ($TAssetOFLine->type == "TO_MAKE" && $type == "TO_MAKE") {
            if (empty($TAssetOFLine->TFournisseurPrice)) {
                $TAssetOFLine->loadFournisseurPrice($PDOdb);
            }
            // Permet de sélectionner par défaut "(Fournisseur "Interne" => Fabrication interne)" si le produit TO_MAKE n'a pas de stock lorsqu'on est en mode edit et que la ligne TO_MAKE n'a pas encore de prix fournisseur enregistré
            dol_include_once('/product/class/product.class.php');
            $p = new Product($db);
            $selected = 0;
            if ($p->fetch($TAssetOFLine->fk_product)) {
                $p->load_stock();
                $p->stock_reel;
                if ($TAssetOFLine->type === 'TO_MAKE' && $p->stock_reel <= 0 && $_REQUEST['action'] === 'edit') {
                    $selected = -2;
                }
            }
            // *************************************************************
            $Tab = array();
            foreach ($TAssetOFLine->TFournisseurPrice as &$objPrice) {
                $label = "";
                //Si on a un prix fournisseur pour le produit
                if ($objPrice->price > 0) {
                    $unit = $objPrice->quantity == 1 ? 'Unité' : 'Unités';
                    $label .= floatval($objPrice->price) . ' ' . $conf->currency . ' - ' . $objPrice->quantity . ' ' . $unit . ' -';
                }
                //Affiche le nom du fournisseur
                $label .= ' (Fournisseur "' . utf8_encode($objPrice->name) . '"';
                //Prix unitaire minimum si renseigné dans le PF
                if ($objPrice->quantity > 0) {
                    ' ' . $objPrice->quantity . ' pièce(s) min,';
                }
                //Affiche le type du PF :
                if ($objPrice->compose_fourni) {
                    //			soit on fabrique les composants
                    $label .= ' => Fabrication interne';
                } elseif ($objPrice->quantity <= 0) {
                    //			soit on a le produit finis déjà en stock
                    $label .= ' => Sortie de stock';
                }
                if ($objPrice->quantity > 0) {
                    //				soit on commande a un fournisseur
                    $label .= ' => Commande fournisseur';
                }
                $label .= ")";
                $Tab[$objPrice->rowid] = array('label' => $label, 'compose_fourni' => $objPrice->compose_fourni ? $objPrice->compose_fourni : 0);
            }
            if ($conf->nomenclature->enabled) {
                dol_include_once('/nomenclature/class/nomenclature.class.php');
                if ($of->status == 'DRAFT' && !$TAssetOFLine->nomenclature_valide) {
                    $TNomenclature = TNomenclature::get($PDOdb, $TAssetOFLine->fk_product, true);
                    if (count($TNomenclature) > 0) {
                        $nomenclature = '<div>' . $form->combo('', 'TAssetOFLine[' . $k . '][fk_nomenclature]', $TNomenclature, $TAssetOFLine->fk_nomenclature);
                        if ($form->type_aff == 'edit') {
                            $nomenclature .= '<a href="#" class="valider_nomenclature" data-id_of="' . $of->getId() . '" data-product="' . $TAssetOFLine->fk_product . '" data-of_line="' . $TAssetOFLine->rowid . '">Valider</a>';
                        } else {
                            $nomenclature .= " - Nomenclature à sélectionner";
                        }
                        $nomenclature .= '</div>';
                    } else {
                        $nomenclature = '';
                    }
                } else {
                    $n = new TNomenclature();
                    $n->load($PDOdb, $TAssetOFLine->fk_nomenclature);
                    $nomenclature = '<div>' . (string) $n;
                    $picture = $TAssetOFLine->nomenclature_valide ? 'ok.png' : 'no.png';
                    $nomenclature .= ' <img src="img/' . $picture . '" style="padding-left: 2px; vertical-align: middle;" /></div>';
                }
            }
            //($of->status=='DRAFT') ? $form->combo('', 'TAssetOFLine['.$k.'][fk_nomenclature]', _getArrayNomenclature($PDOdb, $TAssetOFLine), $TAssetOFLine->fk_nomenclature) : _getTitleNomenclature($PDOdb, $TAssetOFLine->fk_nomenclature)
            $stock_tomake = TAssetOF::getProductStock($product->id);
            $TLine = array('id' => $TAssetOFLine->getId(), 'idprod' => $form->hidden('TAssetOFLine[' . $k . '][fk_product]', $product->id), 'lot_number' => $of->status == 'DRAFT' ? $form->texte('', 'TAssetOFLine[' . $k . '][lot_number]', $TAssetOFLine->lot_number, 15, 50, 'type_product="TO_MAKE" fk_product="' . $product->id . '"', 'TAssetOFLineLot') : $TAssetOFLine->lot_number, 'libelle' => $product->getNomUrl(1) . ' ' . $product->label . ' - ' . $langs->trans("Stock") . " : " . $stock_tomake . _fiche_ligne_asset($PDOdb, $form, $of, $TAssetOFLine, false), 'nomenclature' => $nomenclature, 'addneeded' => $form->type_aff == 'edit' && $of->status == 'DRAFT' ? '<a href="#null" statut="' . $of->status . '" onclick="addAllLines(' . $of->getId() . ',' . $TAssetOFLine->getId() . ',this);">' . img_picto('Mettre à jour les produits nécessaires', 'object_technic.png') . '</a>' : '', 'qty' => $of->status == 'DRAFT' ? $form->texte('', 'TAssetOFLine[' . $k . '][qty]', $TAssetOFLine->qty, 5, 5, '', '') . $conditionnement_label_edit : $TAssetOFLine->qty . $conditionnement_label, 'qty_used' => $of->status == 'OPEN' || $of->status == 'CLOSE' ? $form->texte('', 'TAssetOFLine[' . $k . '][qty_used]', $TAssetOFLine->qty_used, 5, 5, '', '') . $conditionnement_label_edit : $TAssetOFLine->qty_used . $conditionnement_label, 'fk_product_fournisseur_price' => $form->combo('', 'TAssetOFLine[' . $k . '][fk_product_fournisseur_price]', $Tab, $TAssetOFLine->fk_product_fournisseur_price != 0 ? $TAssetOFLine->fk_product_fournisseur_price : $selected, 1, '', 'style="max-width:250px;"'), 'delete' => $form->type_aff == 'edit' && $of->status == 'DRAFT' ? '<a href="#null" onclick="deleteLine(' . $TAssetOFLine->getId() . ',\'TO_MAKE\');">' . img_picto('Supprimer', 'delete.png') . '</a>' : '', 'fk_entrepot' => !empty($conf->global->ASSET_MANUAL_WAREHOUSE) && ($of->status == 'DRAFT' || $of->status == 'VALID' || $of->status == 'NEEDOFFER' || $of->status == 'ONORDER' || $of->status == 'OPEN') && $form->type_aff == 'edit' ? $formProduct->selectWarehouses($TAssetOFLine->fk_entrepot, 'TAssetOFLine[' . $k . '][fk_entrepot]', '', 0, 0, $TAssetOFLine->fk_product) : $TAssetOFLine->getLibelleEntrepot($PDOdb));
            $action = $form->type_aff;
            $parameter = array('of' => &$of, 'line' => &$TLine, 'type' => 'TO_MAKE');
            $res = $hookmanager->executeHooks('lineObjectOptions', $parameter, $TAssetOFLine, $action);
            if ($res > 0 && !empty($hookmanager->resArray)) {
                $TLine = $hookmanager->resArray;
            }
            $TRes[] = $TLine;
        }
    }
    return $TRes;
}
function tabImport(&$TImport, &$commande)
{
    global $langs, $db, $conf;
    $PDOdb = new TPDOdb();
    $form = new TFormCore();
    $formDoli = new Form($db);
    $formproduct = new FormProduct($db);
    if ($commande->statut >= 5 || $commande->statut <= 2) {
        $form->type_aff = "view";
    }
    if ($commande->statut <= 2 || $commande->statut >= 6) {
        print $langs->trans("OrderStatusNotReadyToDispatch");
    }
    _show_product_ventil($TImport, $commande, $form);
    print count($TImport) . ' équipement(s) dans votre réception';
    ?>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#dispatchAsset").change(function() {
				$("#actionVentilation").addClass("error").html("<?php 
    echo $langs->trans('SaveBeforeVentil');
    ?>
");
			});
		});
	</script>
	<table width="100%" class="border" id="dispatchAsset">
		<tr class="liste_titre">
			<td>Produit</td>
			<td>Numéro de Série</td>
			<td>Numéro de Lot</td>
			<td><?php 
    echo $langs->trans('Warehouse');
    ?>
</td>
			<?php 
    if ($conf->global->ASSET_SHOW_DLUO) {
        ?>
				<td>DLUO</td>
			<?php 
    }
    if (empty($conf->global->DISPATCH_USE_ONLY_UNIT_ASSET_RECEPTION)) {
        ?>
			<td>Quantité</td>
			<?php 
        if (!empty($conf->global->DISPATCH_SHOW_UNIT_RECEPTION)) {
            echo '<td>Unité</td>';
        }
    }
    if ($conf->global->clinomadic->enabled) {
        ?>
				<td>IMEI</td>
				<td>Firmware</td>
				<?php 
    }
    ?>
			<td>&nbsp;</td>
		</tr>

	<?php 
    $prod = new Product($db);
    $warning_asset = false;
    if (is_array($TImport)) {
        foreach ($TImport as $k => $line) {
            if ($prod->id == 0 || $line['ref'] != $prod->ref) {
                if (empty($line['fk_product']) === false) {
                    $prod->fetch($line['fk_product']);
                } else {
                    if (empty($line['ref']) === false) {
                        $prod->fetch('', $line['ref']);
                    } else {
                        continue;
                    }
                }
            }
            ?>
<tr>
					<td><?php 
            echo $prod->getNomUrl(1) . $form->hidden('TLine[' . $k . '][fk_product]', $prod->id) . $form->hidden('TLine[' . $k . '][ref]', $prod->ref) . " - " . $prod->label;
            ?>
</td>
					<td><?php 
            echo $form->texte('', 'TLine[' . $k . '][numserie]', $line['numserie'], 30);
            $asset = new TAsset();
            if (empty($line['numserie'])) {
                echo img_picto($langs->trans('SerialNumberNeeded'), 'warning.png');
                $warning_asset = true;
            } else {
                if ($asset->loadReference($PDOdb, $line['numserie'])) {
                    echo '<a href="' . dol_buildpath('/asset/fiche.php?id=' . $asset->getId(), 1) . '">' . img_picto('Equipement lié à cet import', 'info.png') . '</a>';
                } else {
                    echo img_picto('Aucun équipement créé en Base', 'warning.png');
                    $warning_asset = true;
                }
            }
            echo $form->hidden('TLine[' . $k . '][commande_fournisseurdet_asset]', $line['commande_fournisseurdet_asset'], 30);
            ?>
					</td>
					<td><?php 
            echo $form->texte('', 'TLine[' . $k . '][lot_number]', $line['lot_number'], 30);
            ?>
</td>
					<td rel="entrepotChild" fk_product="<?php 
            echo $prod->id;
            ?>
"><?php 
            $formproduct = new FormProduct($db);
            $formproduct->loadWarehouses();
            if (count($formproduct->cache_warehouses) > 1) {
                print $formproduct->selectWarehouses($line['fk_warehouse'], 'TLine[' . $k . '][entrepot]', '', 1, 0, $prod->id, '', 0, 1);
            } elseif (count($formproduct->cache_warehouses) == 1) {
                print $formproduct->selectWarehouses($line['fk_warehouse'], 'TLine[' . $k . '][entrepot]', '', 0, 0, $prod->id, '', 0, 1);
            } else {
                print $langs->trans("NoWarehouseDefined");
            }
            ?>
</td>
					<?php 
            if (!empty($conf->global->ASSET_SHOW_DLUO)) {
                ?>
					<td><?php 
                echo $form->calendrier('', 'TLine[' . $k . '][dluo]', date('d/m/Y', strtotime($line['dluo'])));
                ?>
</td>
					<?php 
            }
            if (empty($conf->global->DISPATCH_USE_ONLY_UNIT_ASSET_RECEPTION)) {
                ?>
						<td><?php 
                echo $form->texte('', 'TLine[' . $k . '][quantity]', $line['quantity'], 10);
                ?>
</td><?php 
                if (!empty($conf->global->DISPATCH_SHOW_UNIT_RECEPTION)) {
                    echo '<td>' . ($commande->statut < 5) ? $formproduct->select_measuring_units('TLine[' . $k . '][quantity_unit]', 'weight', $line['quantity_unit']) : measuring_units_string($line['quantity_unit'], 'weight') . '</td>';
                }
            } else {
                echo $form->hidden('TLine[' . $k . '][quantity]', $line['quantity']);
                echo $form->hidden('TLine[' . $k . '][quantity_unit]', $line['quantity_unit']);
            }
            if ($conf->global->clinomadic->enabled) {
                ?>
						<td><?php 
                echo $form->texte('', 'TLine[' . $k . '][imei]', $line['imei'], 30);
                ?>
</td>
						<td><?php 
                echo $form->texte('', 'TLine[' . $k . '][firmware]', $line['firmware'], 30);
                ?>
</td>
						<?php 
            }
            ?>
					<td>
						<?php 
            if ($commande->statut < 5) {
                echo '<a href="?action=DELETE_LINE&k=' . $k . '&id=' . $commande->id . '&rowid=' . $line['commande_fournisseurdet_asset'] . '">' . img_delete() . '</a>';
            }
            ?>
					</td>
				</tr>
				<?php 
        }
    }
    if ($commande->statut < 5 && $commande->statut > 2) {
        $pListe[0] = "Sélectionnez un produit";
        foreach ($commande->lines as $line) {
            if ($line->fk_product) {
                $pListe[$line->fk_product] = $line->product_ref . " - " . $line->product_label;
            }
        }
        $defaultDLUO = '';
        if ($conf->global->DISPATCH_DLUO_BY_DEFAULT) {
            $defaultDLUO = date('d/m/Y', strtotime(date('Y-m-d') . " " . $conf->global->DISPATCH_DLUO_BY_DEFAULT));
        }
        echo $defaultDLUO;
        ?>
<tr style="background-color: lightblue;">
					<td><?php 
        print $form->combo('', 'new_line_fk_product', $pListe, '');
        ?>
</td>
					<td><?php 
        echo $form->texte('', 'TLine[-1][numserie]', '', 30);
        ?>
</td>
					<td><?php 
        echo $form->texte('', 'TLine[-1][lot_number]', '', 30);
        ?>
</td>
					<td><?php 
        $formproduct = new FormProduct($db);
        $formproduct->loadWarehouses();
        if (count($formproduct->cache_warehouses) > 1) {
            print $formproduct->selectWarehouses('', 'TLine[-1][entrepot]', '', 1, 0, $prod->id, '', 0, 1);
        } elseif (count($formproduct->cache_warehouses) == 1) {
            print $formproduct->selectWarehouses('', 'TLine[-1][entrepot]', '', 0, 0, $prod->id, '', 0, 1);
        } else {
            print $langs->trans("NoWarehouseDefined");
        }
        ?>
</td>
					<?php 
        if (!empty($conf->global->ASSET_SHOW_DLUO)) {
            ?>
						<td><?php 
            echo $form->calendrier('', 'TLine[-1][dluo]', $defaultDLUO);
            ?>
</td>
					<?php 
        }
        if (empty($conf->global->DISPATCH_USE_ONLY_UNIT_ASSET_RECEPTION)) {
            ?>
					<td><?php 
            echo $form->texte('', 'TLine[-1][quantity]', '', 10);
            ?>
</td><?php 
            if (!empty($conf->global->DISPATCH_SHOW_UNIT_RECEPTION)) {
                echo '<td>' . $formproduct->select_measuring_units('TLine[-1][quantity_unit]', 'weight') . '</td>';
            }
        }
        if ($conf->global->clinomadic->enabled) {
            ?>
						<td><?php 
            echo $form->texte('', 'TLine[-1][imei]', '', 30);
            ?>
</td>
						<td><?php 
            echo $form->texte('', 'TLine[-1][firmware]', '', 30);
            ?>
</td>
						<?php 
        }
        ?>
					<td>Nouveau
					</td>
				</tr>
			<?php 
    }
    ?>


	</table>
	<?php 
    if ($commande->statut < 5 || $warning_asset) {
        if ($commande->statut < 5) {
            echo '<div class="tabsAction">' . $form->btsubmit('Enregistrer', 'bt_save') . '</div>';
        }
        $form->type_aff = 'edit';
        ?>
		<hr />
		<?php 
        echo '<div id="actionVentilation">';
        echo 'Date de réception : ' . $form->calendrier('', 'date_recep', time());
        echo ' - ' . $langs->trans("Comment") . ' : ' . $form->texte('', 'comment', $_POST["comment"] ? GETPOST("comment") : $langs->trans("DispatchSupplierOrder", $commande->ref), 60, 128);
        echo ' ' . $form->btsubmit($langs->trans('AssetVentil'), 'bt_create');
        echo '</div>';
    }
}
// Product
print '<td>';
$filtertype = 0;
if (!empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
    $filtertype = '';
}
if ($conf->global->PRODUIT_LIMIT_SIZE <= 0) {
    $limit = '';
} else {
    $limit = $conf->global->PRODUIT_LIMIT_SIZE;
}
print $form->select_produits($id_product, 'productid', $filtertype, $limit);
print '</td>';
// In warehouse
print '<td>';
print $formproduct->selectWarehouses($id_sw, 'id_sw', '', 1);
print '</td>';
// Out warehouse
print '<td>';
print $formproduct->selectWarehouses($id_tw, 'id_tw', '', 1);
print '</td>';
// Qty
print '<td align="center"><input type="text" size="4" class="flat" name="qty" value="' . $qty . '"></td>';
// Button to add line
if (!$listofdata) {
    print '<td align="right"><input type="submit" class="button" name="addline" value="' . dol_escape_htmltag($titletoadd) . '"></td>';
}
print '</tr>';
foreach ($listofdata as $key => $val) {
    $var = !$var;
    $productstatic->fetch($val['id_product']);
示例#15
0
	print '<tr '.$bc[$var].'><td>'.$langs->trans("CashDeskBankAccountForCheque").'</td>';
	print '<td colspan="2">';
	$form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE,'CASHDESK_ID_BANKACCOUNT_CHEQUE',0,"courant=1",1);
	print '</td></tr>';

	$var=!$var;
	print '<tr '.$bc[$var].'><td>'.$langs->trans("CashDeskBankAccountForCB").'</td>';
	print '<td colspan="2">';
	$form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CB,'CASHDESK_ID_BANKACCOUNT_CB',0,"courant=1",1);
	print '</td></tr>';
}

if ($conf->stock->enabled)
{
	$var=!$var;
	print '<tr '.$bc[$var].'><td>'.$langs->trans("CashDeskIdWareHouse").'</td>';
	print '<td colspan="2">';
	$formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE,'CASHDESK_ID_WAREHOUSE','',1);
	print '</td></tr>';
}

print '</table>';
print '<br>';

print '<center><input type="submit" class="button" value="'.$langs->trans("Save").'"></center>';

print "</form>\n";

llxFooter('$Date: 2011/08/03 00:46:38 $ - $Revision: 1.7 $');
?>
    print '</td></tr>';
    // Bank_extra
    print '<tr><td valign="top" >' . $langs->trans("PaymentBankExtra") . '</td>';
    print '<td colspan="3">';
    print $form->select_comptes(isset($_POST["bank_extra"]) ? $_POST["bank_extra"] : 1, 'bank_extra', 0, $filtrebank);
    print '</td></tr>';
    // Mode payment Bank
    print '<tr><td valign="top" >' . $langs->trans("ModePaymentBankExtra") . '</td>';
    print '<td colspan="3">';
    print $form->select_types_paiements(isset($_POST["modebank_extra"]) ? $_POST["modebank_extra"] : 0, 'modebank_extra', '', 0);
    print '</td></tr>';
    if ($conf->stock->enabled) {
        //Stock
        print '<tr><td valign="top" class="fieldrequired">' . $langs->trans("CashDeskIdWareHouse") . '</td>';
        print '<td colspan="2">';
        print $formproduct->selectWarehouses(isset($_POST["stock"]) ? $_POST["stock"] : 1, 'stock', '', 1);
        print '</td></tr>';
    }
    //Soc
    print '<tr><td valign="top" class="fieldrequired">' . $langs->trans("CashDeskThirdPartyForSell") . '</td>';
    print '<td colspan="3">';
    print $form->select_company(isset($_POST["soc"]) ? $_POST["soc"] : 1, 'soc', 's.client=1 or s.client=3', 1, 1);
    print '</td></tr>';
    print '<tr><td align="center" colspan="4"><input value="' . $langs->trans("CreateCash") . '" type="submit" class="button"></td></tr>';
    print '</form>';
    print '</table>';
} else {
    if (($id || $ref) && $action != 'edit') {
        $cash = new Cash($db);
        $cash->fetch($id, $ref);
        /*
 if (!empty($conf->global->SHIPPABLEORDER_DEFAULT_WAREHOUSE)) {
     $default_wharehouse = $conf->global->SHIPPABLEORDER_DEFAULT_WAREHOUSE;
 } else {
     // Sélection de l'entrepot à déstocker pour l'expédition
     // On met par défaut le premier entrepot créé
     $sql2 = "SELECT rowid";
     $sql2 .= " FROM " . MAIN_DB_PREFIX . "entrepot";
     $sql2 .= " ORDER BY rowid ASC";
     $sql2 .= " LIMIT 1";
     $resql2 = $db->query($sql2);
     $res2 = $db->fetch_object($resql2);
     $default_wharehouse = $res2->rowid;
 }
 if ($shippableOrder->nbProduct > 0) {
     // TEnt_comm[] : clef = id_commande val = id_entrepot
     print '<td align="right" class="nowrap">' . $formproduct->selectWarehouses($default_wharehouse, 'TEnt_comm[' . $objp->rowid . ']', '', 1) . '</td>';
     /*echo strtotime($objp->date_livraison);exit;
     	 echo dol_now();exit;*/
     // Checkbox pour créer expédition
     $checked = $shippableOrder->is_ok_for_shipping() && strtotime($objp->date_livraison) <= dol_now() ? 'checked="checked"' : '';
     if ($conf->global->SHIPPABLEORDER_NO_DEFAULT_CHECK) {
         $checked = false;
     }
     print '<td align="right" class="nowrap">' . '<input class="checkforgen" type="checkbox" ' . $checked . ' name="TIDCommandes[]" value="' . $objp->rowid . '" />' . '</td>';
 } else {
     print '<td colspan="2">&nbsp;</td>';
 }
 print '</tr>';
 $total += $objp->total_ht;
 $totaltoship += $shippableOrder->order->total_ht_to_ship;
 $subtotal += $objp->total_ht;
示例#18
0
				print '<form method="GET" action="'.DOL_URL_ROOT.'/expedition/fiche.php">';
				print '<input type="hidden" name="action" value="create">';
				print '<input type="hidden" name="id" value="'.$commande->id.'">';
				print '<input type="hidden" name="origin" value="commande">';
				print '<input type="hidden" name="origin_id" value="'.$commande->id.'">';
				print '<table class="border" width="100%">';

				$langs->load("stocks");

				print '<tr>';

				if ($conf->stock->enabled)
				{
					print '<td>'.$langs->trans("WarehouseSource").'</td>';
					print '<td>';
					$result=$formproduct->selectWarehouses(-1,'entrepot_id','',1);
					if ($result <= 0)
					{
						print ' &nbsp; No warehouse defined, <a href="'.DOL_URL_ROOT.'/product/stock/fiche.php?action=create">add one</a>';
					}
					print '</td>';
				}
				print '<td align="center">';
				print '<input type="submit" class="button" named="save" value="'.$langs->trans("NewSending").'">';
				if ($reste_a_livrer_total <= 0)
				{
					print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend"));
				}
				print '</td></tr>';

				print "</table>";
示例#19
0
    if (empty($conf->productbatch->enabled)) {
        print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK', $conf->global->CASHDESK_NO_DECREASE_STOCK, 1);
    } else {
        if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) {
            $res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK", 1, 'chaine', 0, '', $conf->entity);
        }
        print $langs->trans('StockDecreaseForPointOfSaleDisabledbyBatch');
    }
    print '</td></tr>';
    $disabled = $conf->global->CASHDESK_NO_DECREASE_STOCK;
    $var = !$var;
    print '<tr ' . $bc[$var] . '><td>' . $langs->trans("CashDeskIdWareHouse") . '</td>';
    // Force warehouse (this is not a default value)
    print '<td colspan="2">';
    if (!$disabled) {
        print $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE, 'CASHDESK_ID_WAREHOUSE', '', 1, $disabled);
        print ' <a href="' . DOL_URL_ROOT . '/product/stock/card.php?action=create&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '">(' . $langs->trans("Create") . ')</a>';
    } else {
        print $langs->trans("StockDecreaseForPointOfSaleDisabled");
    }
    print '</td></tr>';
}
if (!empty($conf->service->enabled)) {
    $var = !$var;
    print '<tr ' . $bc[$var] . '><td>';
    print $langs->trans("CashdeskShowServices");
    print '<td colspan="2">';
    print $form->selectyesno("CASHDESK_SERVICES", $conf->global->CASHDESK_SERVICES, 1);
    print "</td></tr>\n";
}
// Use Dolibarr Receipt Printer
示例#20
0
文件: fiche.php 项目: netors/dolibarr
 // Quantity to send
 print '<td align="left">';
 if ($line->product_type == 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
     print '<input name="idl' . $indiceAsked . '" type="hidden" value="' . $line->id . '">';
     print '<input name="qtyl' . $indiceAsked . '" type="text" size="4" value="' . $defaultqty . '">';
 } else {
     print '0';
 }
 print '</td>';
 // Stock
 if ($conf->stock->enabled) {
     print '<td align="left">';
     if ($line->product_type == 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
         // Show warehous
         if ($_REQUEST["entrepot_id"]) {
             $formproduct->selectWarehouses($_REQUEST["entrepot_id"], 'entl' . $indiceAsked, '', 1, 0, $line->fk_product);
             //print $stock.' '.$quantityToBeDelivered;
             //if ($stock >= 0 && $stock < $quantityToBeDelivered)
             if ($stock < $quantityToBeDelivered) {
                 print ' ' . img_warning($langs->trans("StockTooLow"));
             }
         } else {
             $formproduct->selectWarehouses('', 'entl' . $indiceAsked, '', 1, 0, $line->fk_product);
         }
     } else {
         print $langs->trans("Service");
     }
     print '</td>';
 }
 /*else
 		{
示例#21
0
 print '<input type="hidden" name="action" value="create">';
 //print '<input type="hidden" name="id" value="'.$commande->id.'">';
 print '<input type="hidden" name="shipping_method_id" value="' . $commande->shipping_method_id . '">';
 print '<input type="hidden" name="origin" value="commande">';
 print '<input type="hidden" name="origin_id" value="' . $commande->id . '">';
 print '<table class="border" width="100%">';
 $langs->load("stocks");
 print '<tr>';
 if (!empty($conf->stock->enabled)) {
     $warehousecanbeselectedlater = 1;
     if (!empty($conf->productbatch->enabled)) {
         $warehousecanbeselectedlater = 0;
     }
     print '<td' . ($warehousecanbeselectedlater ? '' : ' class="fieldrequired"') . '>' . $langs->trans("WarehouseSource") . '</td>';
     print '<td>';
     print $formproduct->selectWarehouses(!empty($commande->warehouse_id) ? $commande->warehouse_id : -1, 'entrepot_id', '', 1);
     if (count($formproduct->cache_warehouses) <= 0) {
         print ' &nbsp; ' . $langs->trans("WarehouseSourceNotDefined") . ' <a href="' . DOL_URL_ROOT . '/product/stock/card.php?action=create">' . $langs->trans("AddOne") . '</a>';
     }
     print '</td>';
 }
 print '<td align="center">';
 print '<input type="submit" class="button" named="save" value="' . $langs->trans("NewSending") . '">';
 if ($toBeShippedTotal <= 0) {
     print ' ' . img_warning($langs->trans("WarningNoQtyLeftToSend"));
 }
 print '</td></tr>';
 print "</table>";
 print "</form>\n";
 print '<br>';
 $somethingshown = 1;
示例#22
0
     } else {
         $qualified_for_stock_change = $object->hasProductsOrServices(1);
     }
     if ($object->type != Facture::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) {
         $langs->load("stocks");
         require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
         require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
         $formproduct = new FormProduct($db);
         $warehouse = new Entrepot($db);
         $warehouse_array = $warehouse->list_array();
         if (count($warehouse_array) == 1) {
             $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockDecrease", current($warehouse_array)) : $langs->trans("WarehouseForStockIncrease", current($warehouse_array));
             $value = '<input type="hidden" id="idwarehouse" name="idwarehouse" value="' . key($warehouse_array) . '">';
         } else {
             $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease");
             $value = $formproduct->selectWarehouses(GETPOST('idwarehouse') ? GETPOST('idwarehouse') : 'ifone', 'idwarehouse', '', 1);
         }
         $formquestion = array(array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $value));
     }
     $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?facid=' . $object->id, $langs->trans('UnvalidateBill'), $text, 'confirm_modif', $formquestion, "yes", 1);
 }
 // Confirmation du classement paye
 if ($action == 'paid' && $resteapayer <= 0) {
     $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?facid=' . $object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidBill', $object->ref), 'confirm_paid', '', "yes", 1);
 }
 if ($action == 'paid' && $resteapayer > 0) {
     // Code
     $i = 0;
     $close[$i]['code'] = 'discount_vat';
     $i++;
     $close[$i]['code'] = 'badcustomer';
    //if($r->type == 'EVAL') {
    echo '<br />' . $formCore->zonetexte($langs->trans('CodeToEvalAfter') . '<br />', 'TRouting[' . $r->getId() . '][message_code]', $r->message_code, 50, 2);
    //}
    ?>
</td>
            
            <td valign="top">
            	
            	<table width="100%">
            		<tr>
            			<td><?php 
    echo $langs->trans('WarehouseFrom');
    ?>
</td>
            			<td><?php 
    echo $formProduct->selectWarehouses($r->fk_warehouse_from, 'TRouting[' . $r->getId() . '][fk_warehouse_from]');
    ?>
</td>
            		</tr>
            		
           			<tr>
            			<td><?php 
    echo $langs->trans('WarehouseTo');
    ?>
</td>
            			<td><?php 
    echo $formProduct->selectWarehouses($r->fk_warehouse_to, 'TRouting[' . $r->getId() . '][fk_warehouse_to]');
    ?>
</td>
            		</tr>