$userstatic = new User($db); $objectstatic = new CommandeFournisseur($db); $projectstatic = new Project($db); while ($i < min($num, $conf->liste_limit)) { $obj = $db->fetch_object($resql); $var = !$var; $objectstatic->id = $obj->rowid; $objectstatic->ref = $obj->ref; $objectstatic->ref_supplier = $obj->ref_supplier; $objectstatic->total_ht = $obj->total_ht; $objectstatic->total_tva = $obj->total_tva; $objectstatic->total_ttc = $obj->total_ttc; print "<tr " . $bc[$var] . ">"; // Ref print '<td class="nobordernopadding nowrap">'; print $objectstatic->getNomUrl(1); $filename = dol_sanitizeFileName($obj->ref); $filedir = $conf->fournisseur->dir_output . '/commande' . '/' . dol_sanitizeFileName($obj->ref); print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); print '</td>' . "\n"; // Ref Supplier if (empty($conf->global->SUPPLIER_ORDER_HIDE_REF_SUPPLIER)) { print '<td>' . $obj->ref_supplier . '</td>' . "\n"; } // Thirdparty print '<td>'; $thirdpartytmp->id = $obj->socid; $thirdpartytmp->name = $obj->name; print $thirdpartytmp->getNomUrl(1, 'supplier'); print '</td>' . "\n"; // Project
print '<tr class="liste_titre">'; print '<td colspan="4">' . $langs->trans("LastModifiedOrders", $max) . '</td></tr>'; $num = $db->num_rows($resql); if ($num) { $i = 0; $var = True; while ($i < $num) { $var = !$var; $obj = $db->fetch_object($resql); print "<tr " . $bc[$var] . ">"; print '<td width="20%" class="nowrap">'; $commandestatic->id = $obj->rowid; $commandestatic->ref = $obj->ref; print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<td width="96" class="nobordernopadding nowrap">'; print $commandestatic->getNomUrl(1); print '</td>'; print '<td width="16" class="nobordernopadding nowrap">'; print ' '; print '</td>'; print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">'; $filename = dol_sanitizeFileName($obj->ref); $filedir = $conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource = $_SERVER['PHP_SELF'] . '?id=' . $obj->rowid; print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir); print '</td></tr></table>'; print '</td>'; print '<td><a href="' . DOL_URL_ROOT . '/fourn/card.php?socid=' . $obj->socid . '">' . img_object($langs->trans("ShowCompany"), "company") . ' ' . $obj->name . '</a></td>'; print '<td>' . dol_print_date($db->jdate($obj->tms), 'day') . '</td>'; print '<td align="right">' . $commandestatic->LibStatut($obj->fk_statut, 5) . '</td>'; print '</tr>';
if ($resql) { $total = 0; $num = $db->num_rows($resql); if ($num) { print '<table class="noborder" width="100%">'; print '<tr class="liste_titre">'; print '<td colspan="3">' . $langs->trans("DraftOrders") . ' <span class="badge">' . $num . '</span></td></tr>'; $i = 0; $var = true; while ($i < $num) { $var = !$var; $obj = $db->fetch_object($resql); print '<tr ' . $bc[$var] . '><td class="nowrap">'; $commandestatic->id = $obj->rowid; $commandestatic->ref = $obj->ref; print $commandestatic->getNomUrl(1, '', 16); print '</td>'; print '<td class="nowrap">'; $companystatic->id = $obj->socid; $companystatic->name = $obj->name; $companystatic->client = 0; print $companystatic->getNomUrl(1, '', 16); print '</td>'; print '<td align="right" class="nowrap">' . price($obj->total_ttc) . '</td></tr>'; $i++; $total += $obj->total_ttc; } if ($total > 0) { $var = !$var; print '<tr class="liste_total"><td>' . $langs->trans("Total") . '</td><td colspan="2" align="right">' . price($total) . "</td></tr>"; }
print_liste_field_titre($langs->trans("OrderDate"), $_SERVER["PHP_SELF"], "c.date_commande", "", "&id=" . $product->id, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Qty"), $_SERVER["PHP_SELF"], "d.qty", "", "&id=" . $product->id, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("AmountHT"), $_SERVER["PHP_SELF"], "c.total_ht", "", "&id=" . $product->id, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "c.fk_statut", "", "&id=" . $product->id, 'align="right"', $sortfield, $sortorder); print "</tr>\n"; $commandestatic = new CommandeFournisseur($db); if ($num > 0) { $var = True; while ($i < $num && $i < $conf->liste_limit) { $objp = $db->fetch_object($result); $var = !$var; $commandestatic->id = $objp->commandeid; $commandestatic->ref = $objp->ref; $commandestatic->statut = $objp->statut; print "<tr " . $bc[$var] . ">"; print '<td>' . $commandestatic->getNomUrl(1) . "</td>\n"; print "</a></td>\n"; print '<td><a href="' . DOL_URL_ROOT . '/fourn/card.php?socid=' . $objp->socid . '">' . img_object($langs->trans("ShowCompany"), "company") . ' ' . dol_trunc($objp->name, 44) . '</a></td>'; print "<td>" . $objp->code_client . "</td>\n"; print '<td align="center">' . dol_print_date($db->jdate($objp->date_commande)) . "</td>"; print "<td align=\"center\">" . $objp->qty . "</td>\n"; print '<td align="right">' . price($objp->total_ht) . "</td>\n"; print '<td align="right">' . $commandestatic->getLibStatut(4) . '</td>'; print "</tr>\n"; $i++; } } } else { dol_print_error($db); } print "</table>";
print '<tr class="liste_titre">'; print '<td colspan="3">' . $langs->trans("DraftSuppliersOrders") . ($num ? ' <span class="badge">' . $num . '</span>' : '') . '</td></tr>'; if ($num) { $i = 0; $var = true; while ($i < $num) { $var = !$var; $obj = $db->fetch_object($resql); print '<tr ' . $bc[$var] . '><td class="nowrap">'; $supplierorderstatic->id = $obj->rowid; $supplierorderstatic->ref = $obj->ref; $supplierorderstatic->ref_supplier = $obj->ref_suppliert; $supplierorderstatic->total_ht = $obj->total_ht; $supplierorderstatic->total_tva = $obj->total_tva; $supplierorderstatic->total_ttc = $obj->total_ttc; print $supplierorderstatic->getNomUrl(1); print '</td>'; print '<td class="nowrap">'; $companystatic->id = $obj->socid; $companystatic->name = $obj->name; $companystatic->client = $obj->client; $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas = $obj->canvas; print $companystatic->getNomUrl(1, 'customer', 16); print '</td>'; print '<td align="right" class="nowrap">' . price($obj->total_ttc) . '</td></tr>'; $i++; $total += $obj->total_ttc; } if ($total > 0) {
print '<td width="20px" align="right"><a href="' . DOL_URL_ROOT . '/commande/stats/index.php?mode=supplier&socid=' . $object->id . '">' . img_picto($langs->trans("Statistics"), 'stats') . '</a></td>'; print '</tr></table>'; print '</td></tr>'; } $var = True; while ($i < $num && $i <= $MAXLIST) { $obj = $db->fetch_object($resql); $var = !$var; print "<tr " . $bc[$var] . ">"; print '<td class="nowrap">'; $orderstatic->id = $obj->rowid; $orderstatic->ref = $obj->ref; $orderstatic->total_ht = $obj->total_ht; $orderstatic->total_tva = $obj->total_tva; $orderstatic->total_ttc = $obj->total_ttc; print $orderstatic->getNomUrl(1); print '</td>'; print '<td align="center" width="80">'; if ($obj->dc) { print dol_print_date($db->jdate($obj->dc), 'day'); } else { print "-"; } print '</td>'; print '<td align="right" class="nowrap">' . $orderstatic->LibStatut($obj->fk_statut, 5) . '</td>'; print '</tr>'; $i++; } $db->free($resql); if ($num > 0) { print "</table>";
} print '</td>'; print '</td></tr>'; print '<form name="orders2invoice" action="orderstoinvoice.php" method="GET">'; $var = True; $generic_commande = new CommandeFournisseur($db); while ($i < $num) { $objp = $db->fetch_object($resql); $var = !$var; print '<tr ' . $bc[$var] . '>'; print '<td class="nowrap">'; $generic_commande->id = $objp->rowid; $generic_commande->ref = $objp->ref; print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<td class="nobordernopadding nowrap">'; print $generic_commande->getNomUrl(1, $objp->fk_statut); print '</td>'; print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">'; $filename = dol_sanitizeFileName($objp->ref); $filedir = $conf->fournisseur->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref); $urlsource = $_SERVER['PHP_SELF'] . '?id=' . $objp->rowid; print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir); print '</td></tr></table>'; print '</td>'; print '<td>' . $objp->ref_supplier . '</td>'; // Order date print '<td align="center" nowrap>'; print dol_print_date($db->jdate($objp->date_commande), 'day'); print '</td>'; // Delivery date print '<td align="center" nowrap>';
print '<input type="image" class="liste_titre" name="button_search" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">'; print '<input type="image" class="liste_titre" name="button_removefilter" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("resetFilters")) . '" title="' . dol_escape_htmltag($langs->trans("resetFilters")) . '">'; print '</td>'; print '</tr>'; if ($sql_select) { $var = true; $num = $db->num_rows($resql); $i = 0; while (($objp = $db->fetch_object($resql)) && $i < $conf->liste_limit) { $var = !$var; print "<tr " . $bc[$var] . ">"; print '<td class="nobordernopadding nowrap" width="100">'; $documentstatic->id = $objp->doc_id; $documentstatic->ref = $objp->doc_number; $documentstatic->type = $objp->type; print $documentstatic->getNomUrl(1); print '</td>'; print '<td align="center" width="80">' . dol_print_date($db->jdate($objp->dateprint), 'day') . '</td>'; print '<td>'; // Define text, description and type $text = ''; $description = ''; $type = 0; // Code to show product duplicated from commonobject->printObjectLine if ($objp->fk_product > 0) { $product_static = new Product($db); $product_static->type = $objp->fk_product_type; $product_static->id = $objp->fk_product; $product_static->ref = $objp->ref; $text = $product_static->getNomUrl(1); }
function _fiche(&$PDOdb, &$assetOf, $mode = 'edit', $fk_product_to_add = 0, $fk_nomenclature = 0) { global $langs, $db, $conf, $user, $hookmanager; /*************************************************** * PAGE * * Put here all code to build page ****************************************************/ $parameters = array('id' => $assetOf->getId()); $reshook = $hookmanager->executeHooks('doActions', $parameters, $assetOf, $mode); // Note that $action and $object may have been modified by hook //pre($assetOf,true); llxHeader('', $langs->trans('OFAsset'), '', ''); print dol_get_fiche_head(ofPrepareHead($assetOf, 'assetOF'), 'fiche', $langs->trans('OFAsset')); ?> <style type="text/css"> #assetChildContener .OFMaster { background:#fff; -webkit-box-shadow: 4px 4px 5px 0px rgba(50, 50, 50, 0.52); -moz-box-shadow: 4px 4px 5px 0px rgba(50, 50, 50, 0.52); box-shadow: 4px 4px 5px 0px rgba(50, 50, 50, 0.52); margin-bottom:20px; } </style> <div class="OFContent" rel="<?php echo $assetOf->getId(); ?> "> <?php $TPrixFournisseurs = array(); //$form=new TFormCore($_SERVER['PHP_SELF'],'formeq'.$assetOf->getId(),'POST'); //Affichage des erreurs if (!empty($assetOf->errors)) { ?> <br><div class="error"> <?php foreach ($assetOf->errors as $error) { echo $error . "<br>"; setEventMessage($error, 'errors'); } $assetOf->errors = array(); ?> </div><br> <?php } $form = new TFormCore(); $form->Set_typeaff($mode); $doliform = new Form($db); if (!empty($_REQUEST['fk_product'])) { echo $form->hidden('fk_product', $_REQUEST['fk_product']); } $TBS = new TTemplateTBS(); $liste = new TListviewTBS('asset'); $TBS->TBS->protect = false; $TBS->TBS->noerr = true; $PDOdb = new TPDOdb(); $TNeeded = array(); $TToMake = array(); $TNeeded = _fiche_ligne($form, $assetOf, "NEEDED"); $TToMake = _fiche_ligne($form, $assetOf, "TO_MAKE"); $TIdCommandeFourn = $assetOf->getElementElement($PDOdb); $HtmlCmdFourn = ''; if (count($TIdCommandeFourn)) { foreach ($TIdCommandeFourn as $idcommandeFourn) { $cmd = new CommandeFournisseur($db); $cmd->fetch($idcommandeFourn); $HtmlCmdFourn .= $cmd->getNomUrl(1) . " - " . $cmd->getLibStatut(0); } } ob_start(); $doliform->select_produits('', 'fk_product', '', $conf->product->limit_size, 0, -1, 2, '', 3, array()); $select_product = ob_get_clean(); $Tid = array(); //$Tid[] = $assetOf->rowid; if ($assetOf->getId() > 0) { $assetOf->getListeOFEnfants($PDOdb, $Tid); } $TWorkstation = array(); foreach ($assetOf->TAssetWorkstationOF as $k => &$TAssetWorkstationOF) { $ws =& $TAssetWorkstationOF->ws; $TWorkstation[] = array('libelle' => '<a href="' . dol_buildpath('workstation/workstation.php?id=' . $ws->rowid . '&action=view', 2) . '">' . $ws->name . '</a>', 'fk_user' => visu_checkbox_user($PDOdb, $form, $ws->fk_usergroup, $TAssetWorkstationOF->users, 'TAssetWorkstationOF[' . $k . '][fk_user][]', $assetOf->status), 'fk_project_task' => visu_project_task($db, $TAssetWorkstationOF->fk_project_task, $form->type_aff, 'TAssetWorkstationOF[' . $k . '][progress]'), 'fk_task' => visu_checkbox_task($PDOdb, $form, $TAssetWorkstationOF->fk_asset_workstation, $TAssetWorkstationOF->tasks, 'TAssetWorkstationOF[' . $k . '][fk_task][]', $assetOf->status), 'nb_hour' => $assetOf->status == 'DRAFT' && $mode == "edit" ? $form->texte('', 'TAssetWorkstationOF[' . $k . '][nb_hour]', $TAssetWorkstationOF->nb_hour, 3, 10) : ($conf->global->ASSET_USE_CONVERT_TO_TIME ? convertSecondToTime($TAssetWorkstationOF->nb_hour * 3600) : price($TAssetWorkstationOF->nb_hour)), 'nb_hour_real' => $assetOf->status == 'OPEN' && $mode == "edit" ? $form->texte('', 'TAssetWorkstationOF[' . $k . '][nb_hour_real]', $TAssetWorkstationOF->nb_hour_real, 3, 10) : ($conf->global->ASSET_USE_CONVERT_TO_TIME ? convertSecondToTime($TAssetWorkstationOF->nb_hour_real * 3600) : price($TAssetWorkstationOF->nb_hour_real)), 'nb_days_before_beginning' => $assetOf->status == 'DRAFT' && $mode == "edit" ? $form->texte('', 'TAssetWorkstationOF[' . $k . '][nb_days_before_beginning]', $TAssetWorkstationOF->nb_days_before_beginning, 3, 10) : $TAssetWorkstationOF->nb_days_before_beginning, 'delete' => $mode == 'edit' && $assetOf->status == 'DRAFT' ? '<a href="javascript:deleteWS(' . $assetOf->getId() . ',' . $TAssetWorkstationOF->getId() . ');">' . img_picto('Supprimer', 'delete.png') . '</a>' : '', 'note_private' => $assetOf->status == 'DRAFT' && $mode == 'edit' ? $form->zonetexte('', 'TAssetWorkstationOF[' . $k . '][note_private]', $TAssetWorkstationOF->note_private, 50, 1) : $TAssetWorkstationOF->note_private, 'rang' => $assetOf->status == 'DRAFT' && $mode == "edit" ? $form->texte('', 'TAssetWorkstationOF[' . $k . '][rang]', $TAssetWorkstationOF->rang, 3, 10) : $TAssetWorkstationOF->rang, 'id' => $ws->getId()); } $client = new Societe($db); if ($assetOf->fk_soc > 0) { $client->fetch($assetOf->fk_soc); } $commande = new Commande($db); if ($assetOf->fk_commande > 0) { $commande->fetch($assetOf->fk_commande); } $TOFParent = array_merge(array(0 => ''), $assetOf->getCanBeParent($PDOdb)); $hasParent = false; if (!empty($assetOf->fk_assetOf_parent)) { $TAssetOFParent = new TAssetOF(); $TAssetOFParent->load($PDOdb, $assetOf->fk_assetOf_parent); $hasParent = true; } $parameters = array('id' => $assetOf->getId()); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $assetOf, $mode); // Note that $action and $object may have been modified by hook if ($fk_product_to_add > 0) { $product_to_add = new Product($db); $product_to_add->fetch($fk_product_to_add); $link_product_to_add = $product_to_add->getNomUrl(1) . ' ' . $product_to_add->label; $quantity_to_create = $form->texte('', 'quantity_to_create', 1, 3, 255); } else { $link_product_to_add = ''; $quantity_to_create = ''; } print $TBS->render('tpl/fiche_of.tpl.php', array('TNeeded' => $TNeeded, 'TTomake' => $TToMake, 'workstation' => $TWorkstation), array('assetOf' => array('id' => $assetOf->getId(), 'numero' => $assetOf->getId() > 0 ? '<a href="fiche_of.php?id=' . $assetOf->getId() . '">' . $assetOf->getNumero($PDOdb) . '</a>' : $assetOf->getNumero($PDOdb), 'ordre' => $form->combo('', 'ordre', TAssetOf::$TOrdre, $assetOf->ordre), 'fk_commande' => $assetOf->fk_commande == 0 ? '' : $commande->getNomUrl(1), 'commande_fournisseur' => $HtmlCmdFourn, 'date_besoin' => $form->calendrier('', 'date_besoin', $assetOf->date_besoin, 12, 12), 'date_lancement' => $form->calendrier('', 'date_lancement', $assetOf->date_lancement, 12, 12), 'temps_estime_fabrication' => price($assetOf->temps_estime_fabrication, 0, '', 1, -1, 2), 'temps_reel_fabrication' => price($assetOf->temps_reel_fabrication, 0, '', 1, -1, 2), 'fk_soc' => $mode == 'edit' ? $doliform->select_company($assetOf->fk_soc, 'fk_soc', 'client=1', 1) : ($client->id ? $client->getNomUrl(1) : ''), 'fk_project' => custom_select_projects(-1, $assetOf->fk_project, 'fk_project', $mode), 'note' => $form->zonetexte('', 'note', $assetOf->note, 80, 5), 'quantity_to_create' => $quantity_to_create, 'product_to_create' => $link_product_to_add, 'status' => $form->combo('', 'status', TAssetOf::$TStatus, $assetOf->status), 'statustxt' => TAssetOf::$TStatus[$assetOf->status], 'idChild' => !empty($Tid) ? '"' . implode('","', $Tid) . '"' : '', 'url' => dol_buildpath('/of/fiche_of.php', 2), 'url_liste' => $assetOf->getId() ? dol_buildpath('/of/fiche_of.php?id=' . $assetOf->getId(), 2) : dol_buildpath('/of/liste_of.php', 2), 'fk_product_to_add' => $fk_product_to_add, 'fk_nomenclature' => $fk_nomenclature, 'fk_assetOf_parent' => $assetOf->fk_assetOf_parent ? $assetOf->fk_assetOf_parent : '', 'link_assetOf_parent' => $hasParent ? '<a href="' . dol_buildpath('/of/fiche_of.php?id=' . $TAssetOFParent->rowid, 2) . '">' . $TAssetOFParent->numero . '</a>' : '', 'total_cost' => price($assetOf->total_cost, 0, '', 1, -1, 2), 'total_estimated_cost' => price($assetOf->total_estimated_cost, 0, '', 1, -1, 2), 'mo_cost' => price($assetOf->mo_cost, 0, '', 1, -1, 2), 'mo_estimated_cost' => price($assetOf->mo_estimated_cost, 0, '', 1, -1, 2), 'compo_cost' => price($assetOf->compo_cost, 0, '', 1, -1, 2), 'compo_estimated_cost' => price($assetOf->compo_estimated_cost, 0, '', 1, -1, 2), 'current_cost_for_to_make' => price($assetOf->current_cost_for_to_make, 0, '', 1, -1, 2)), 'view' => array('mode' => $mode, 'status' => $assetOf->status, 'allow_delete_of_finish' => $user->rights->of->of->allow_delete_of_finish, 'ASSET_USE_MOD_NOMENCLATURE' => (int) $conf->nomenclature->enabled, 'OF_MINIMAL_VIEW_CHILD_OF' => (int) $conf->global->OF_MINIMAL_VIEW_CHILD_OF, 'select_product' => $select_product, 'select_workstation' => $form->combo('', 'fk_asset_workstation', TWorkstation::getWorstations($PDOdb), -1), 'actionChild' => $mode == 'edit' ? __get('actionChild', 'edit') : __get('actionChild', 'view'), 'use_lot_in_of' => (int) (!empty($conf->asset->enabled) && !empty($conf->global->USE_LOT_IN_OF)), 'use_project_task' => (int) $conf->global->ASSET_USE_PROJECT_TASK, 'defined_user_by_workstation' => (int) $conf->global->ASSET_DEFINED_USER_BY_WORKSTATION, 'defined_task_by_workstation' => (int) $conf->global->ASSET_DEFINED_OPERATION_BY_WORKSTATION, 'defined_workstation_by_needed' => (int) $conf->global->ASSET_DEFINED_WORKSTATION_BY_NEEDED, 'defined_manual_wharehouse' => (int) $conf->global->ASSET_MANUAL_WAREHOUSE, 'hasChildren' => (int) (!empty($Tid)), 'user_id' => $user->id, 'workstation_module_activate' => (int) $conf->workstation->enabled, 'show_cost' => (int) $user->rights->of->of->price), 'rights' => array('show_ws_time' => $user->rights->of->of->show_ws_time))); echo $form->end_form(); llxFooter('$Date: 2011/07/31 22:21:57 $ - $Revision: 1.19 $'); }