Esempio n. 1
0
     $product_static->id = $fields['pid'];
     $product_static->ref = $fields['pref'];
     $product_static->type = $fields['ptype'];
     print $product_static->getNomUrl(1);
     if (dol_string_nohtmltag($fields['descr'])) {
         print ' - ' . dol_trunc(dol_string_nohtmltag($fields['descr']), 16);
     }
 } else {
     if ($type) {
         $text = img_object($langs->trans('Service'), 'service');
     } else {
         $text = img_object($langs->trans('Product'), 'product');
     }
     print $text . ' ' . dol_trunc(dol_string_nohtmltag($fields['descr']), 16);
     // Show range
     print_date_range($fields['ddate_start'], $fields['ddate_end']);
 }
 print '</td>';
 // Total HT
 if ($modetax == 0) {
     print '<td class="nowrap" align="right">';
     print price($fields['totalht']);
     if (price2num($fields['ftotal_ttc'])) {
         //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - ";
         $ratiolineinvoice = $fields['dtotal_ttc'] / $fields['ftotal_ttc'];
         //print ' ('.round($ratiolineinvoice*100,2).'%)';
     }
     print '</td>';
 }
 // Payment
 $ratiopaymentinvoice = 1;
Esempio n. 2
0
					$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($delivery->lines[$i]->description));
					//print $description;
					print $html->textwithtooltip($text,$description,3,'','',$i);
					print_date_range($delivery->lines[$i]->date_start,$delivery->lines[$i]->date_end);
					if ($conf->global->PRODUIT_DESC_IN_FORM)
					{
						print ($delivery->lines[$i]->description && $delivery->lines[$i]->description!=$delivery->lines[$i]->label)?'<br>'.dol_htmlentitiesbr($delivery->lines[$i]->description):'';
					}
				}
				else
				{
					print "<td>";
					if ($delivery->lines[$i]->fk_product_type==1) $text = img_object($langs->trans('Service'),'service');
					else $text = img_object($langs->trans('Product'),'product');
					print $text.' '.nl2br($delivery->lines[$i]->description);
					print_date_range($objp->date_start,$objp->date_end);
					print "</td>\n";
				}

				print '<td align="center">'.$delivery->lines[$i]->qty_asked.'</td>';
				print '<td align="center">'.$delivery->lines[$i]->qty_shipped.'</td>';

				print "</tr>";

				$i++;
			}

			print "</table>\n";

			print "\n</div>\n";
/**
 * List sendings and receive receipts
 *
 * @param   string		$origin			Origin ('commande', ...)
 * @param	int			$origin_id		Origin id
 * @param	string		$filter			Filter
 * @return	int							<0 if KO, >0 if OK
 */
function show_list_sending_receive($origin, $origin_id, $filter = '')
{
    global $db, $conf, $langs, $bc;
    global $form;
    $product_static = new Product($db);
    $expedition = new Expedition($db);
    $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end";
    $sql .= ", ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line";
    $sql .= ", e.rowid as sendingid, e.ref as exp_ref, e.date_creation, e.date_delivery, e.date_expedition,";
    //if ($conf->livraison_bon->enabled) $sql .= " l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received,";
    $sql .= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,';
    $sql .= ' p.description as product_desc';
    $sql .= " FROM " . MAIN_DB_PREFIX . "expeditiondet as ed";
    $sql .= ", " . MAIN_DB_PREFIX . "expedition as e";
    $sql .= ", " . MAIN_DB_PREFIX . $origin . "det as obj";
    //if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."livraisondet as ld ON ld.fk_livraison = l.rowid  AND obj.rowid = ld.fk_origin_line";
    $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON obj.fk_product = p.rowid";
    $sql .= " WHERE e.entity = " . $conf->entity;
    $sql .= " AND obj.fk_" . $origin . " = " . $origin_id;
    $sql .= " AND obj.rowid = ed.fk_origin_line";
    $sql .= " AND ed.fk_expedition = e.rowid";
    if ($filter) {
        $sql .= $filter;
    }
    $sql .= " ORDER BY obj.fk_product";
    dol_syslog("show_list_sending_receive sql=" . $sql, LOG_DEBUG);
    $resql = $db->query($sql);
    if ($resql) {
        $num = $db->num_rows($resql);
        $i = 0;
        if ($num) {
            if ($filter) {
                print_titre($langs->trans("OtherSendingsForSameOrder"));
            } else {
                print_titre($langs->trans("SendingsAndReceivingForSameOrder"));
            }
            print '<table class="liste" width="100%">';
            print '<tr class="liste_titre">';
            //print '<td align="left">'.$langs->trans("QtyOrdered").'</td>';
            print '<td align="left">' . $langs->trans("SendingSheet") . '</td>';
            print '<td align="left">' . $langs->trans("Description") . '</td>';
            print '<td align="center">' . $langs->trans("DateCreation") . '</td>';
            print '<td align="center">' . $langs->trans("DateDeliveryPlanned") . '</td>';
            print '<td align="center">' . $langs->trans("QtyShipped") . '</td>';
            if ($conf->livraison_bon->enabled) {
                print '<td>' . $langs->trans("DeliveryOrder") . '</td>';
                //print '<td align="center">'.$langs->trans("QtyReceived").'</td>';
                print '<td align="right">' . $langs->trans("DeliveryDate") . '</td>';
            }
            print "</tr>\n";
            $var = True;
            while ($i < $num) {
                $var = !$var;
                $objp = $db->fetch_object($resql);
                print "<tr " . $bc[$var] . ">";
                // Sending id
                print '<td align="left" class="nowrap"><a href="' . DOL_URL_ROOT . '/expedition/fiche.php?id=' . $objp->expedition_id . '">' . img_object($langs->trans("ShowSending"), 'sending') . ' ' . $objp->exp_ref . '<a></td>';
                // Description
                if ($objp->fk_product > 0) {
                    // Define output language
                    if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
                        $object = new $origin($db);
                        $object->fetch($origin_id);
                        $object->fetch_thirdparty();
                        $prod = new Product($db);
                        $prod->id = $objp->fk_product;
                        $prod->getMultiLangs();
                        $outputlangs = $langs;
                        $newlang = '';
                        if (empty($newlang) && !empty($_REQUEST['lang_id'])) {
                            $newlang = $_REQUEST['lang_id'];
                        }
                        if (empty($newlang)) {
                            $newlang = $object->client->default_lang;
                        }
                        if (!empty($newlang)) {
                            $outputlangs = new Translate("", $conf);
                            $outputlangs->setDefaultLang($newlang);
                        }
                        $label = !empty($prod->multilangs[$outputlangs->defaultlang]["label"]) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label;
                    } else {
                        $label = !empty($objp->label) ? $objp->label : $objp->product_label;
                    }
                    print '<td>';
                    // Show product and description
                    $product_static->type = $objp->fk_product_type;
                    $product_static->id = $objp->fk_product;
                    $product_static->ref = $objp->ref;
                    $text = $product_static->getNomUrl(1);
                    $text .= ' - ' . $label;
                    $description = !empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($objp->description);
                    print $form->textwithtooltip($text, $description, 3, '', '', $i);
                    // Show range
                    print_date_range($objp->date_start, $objp->date_end);
                    // Add description in form
                    if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
                        print !empty($objp->description) && $objp->description != $objp->product ? '<br>' . dol_htmlentitiesbr($objp->description) : '';
                    }
                    print '</td>';
                } else {
                    print "<td>";
                    if ($objp->fk_product_type == 1) {
                        $text = img_object($langs->trans('Service'), 'service');
                    } else {
                        $text = img_object($langs->trans('Product'), 'product');
                    }
                    if (!empty($objp->label)) {
                        $text .= ' <strong>' . $objp->label . '</strong>';
                        print $form->textwithtooltip($text, $objp->description, 3, '', '', $i);
                    } else {
                        print $text . ' ' . nl2br($objp->description);
                    }
                    // Show range
                    print_date_range($objp->date_start, $objp->date_end);
                    print "</td>\n";
                }
                //print '<td align="center">'.$objp->qty_asked.'</td>';
                // Date creation
                print '<td align="center" class="nowrap">' . dol_print_date($db->jdate($objp->date_creation), 'day') . '</td>';
                // Date shipping creation
                print '<td align="center" class="nowrap">' . dol_print_date($db->jdate($objp->date_delivery), 'day') . '</td>';
                // Qty shipped
                print '<td align="center">' . $objp->qty_shipped . '</td>';
                // Informations on receipt
                if (!empty($conf->livraison_bon->enabled)) {
                    include_once DOL_DOCUMENT_ROOT . '/livraison/class/livraison.class.php';
                    $expedition->id = $objp->sendingid;
                    $expedition->fetchObjectLinked($expedition->id, $expedition->element);
                    //var_dump($expedition->linkedObjects);
                    $receiving = !empty($expedition->linkedObjects['delivery'][0]) ? $expedition->linkedObjects['delivery'][0] : '';
                    if (!empty($receiving)) {
                        // $expedition->fk_origin_line = id of det line of order
                        // $receiving->fk_origin_line = id of det line of order
                        // $receiving->origin may be 'shipping'
                        // $receiving->origin_id may be id of shipping
                        // Ref
                        print '<td>';
                        print $receiving->getNomUrl($db);
                        //print '<a href="'.DOL_URL_ROOT.'/livraison/fiche.php?id='.$livraison_id.'">'.img_object($langs->trans("ShowReceiving"),'sending').' '.$objp->livraison_ref.'<a>';
                        print '</td>';
                        // Qty received
                        //print '<td align="center">';
                        // TODO No solution for the moment to link a line det of receipt with a line det of shipping,
                        // so no way to know the qty received for this line of shipping.
                        //print $langs->trans("FeatureNotYetAvailable");
                        //print '</td>';
                        // Date shipping real
                        print '<td align="right">';
                        print dol_print_date($receiving->date_delivery, 'day');
                        print '</td>';
                    } else {
                        //print '<td>&nbsp;</td>';
                        print '<td>&nbsp;</td>';
                        print '<td>&nbsp;</td>';
                    }
                }
                print '</tr>';
                $i++;
            }
            print '</table>';
        }
        $db->free($resql);
    } else {
        dol_print_error($db);
    }
    return 1;
}
Esempio n. 4
0
     }
     print "</td>\n";
 } else {
     print "<td>";
     if ($lines[$i]->fk_product_type == 1) {
         $text = img_object($langs->trans('Service'), 'service');
     } else {
         $text = img_object($langs->trans('Product'), 'product');
     }
     if (!empty($lines[$i]->label)) {
         $text .= ' <strong>' . $lines[$i]->label . '</strong>';
         print $form->textwithtooltip($text, $lines[$i]->description, 3, '', '', $i);
     } else {
         print $text . ' ' . nl2br($lines[$i]->description);
     }
     print_date_range($lines[$i]->date_start, $lines[$i]->date_end);
     print "</td>\n";
 }
 // Qte commande
 print '<td align="center">' . $lines[$i]->qty_asked . '</td>';
 // Qte a expedier ou expedier
 print '<td align="center">' . $lines[$i]->qty_shipped . '</td>';
 // Weight
 print '<td align="center">';
 if ($lines[$i]->fk_product_type == 0) {
     print $lines[$i]->weight * $lines[$i]->qty_shipped . ' ' . measuring_units_string($lines[$i]->weight_units, "weight");
 } else {
     print '&nbsp;';
 }
 print '</td>';
 // Volume
Esempio n. 5
0
         print '</td>';
     } else {
         print '<td>';
         if ($type == 1) {
             $text = img_object($langs->trans('Service'), 'service');
         } else {
             $text = img_object($langs->trans('Product'), 'product');
         }
         if (!empty($object->lines[$i]->label)) {
             $text .= ' <strong>' . $object->lines[$i]->label . '</strong>';
             print $form->textwithtooltip($text, dol_htmlentitiesbr($object->lines[$i]->desc), 3, '', '', $i);
         } else {
             print $text . ' ' . nl2br($object->lines[$i]->desc);
         }
         // Show range
         print_date_range($object->lines[$i]->date_start, $object->lines[$i]->date_end);
         print '</td>';
     }
     print '<td align="right">' . price($object->lines[$i]->price) . '</td>';
     print '<td align="center">' . $object->lines[$i]->remise_percent . ' %</td>';
     print '<td align="center">' . $object->lines[$i]->qty . '</td>';
     if ($conf->global->PRODUCT_USE_UNITS) {
         print "<td align=\"left\">" . $object->lines[$i]->getLabelOfUnit() . "</td>";
     }
     print "</tr>\n";
     $i++;
 }
 print '</table>';
 /**
  * Barre d'actions
  */
Esempio n. 6
0
					if ($conf->global->PRODUIT_DESC_IN_FORM)
					{
						print ($objp->description && $objp->description!=$objp->product_label)?'<br>'.dol_htmlentitiesbr($objp->description):'';
					}

					print '</td>';
				}
				else
				{
					print "<td>";
					if ($type==1) $text = img_object($langs->trans('Service'),'service');
					else $text = img_object($langs->trans('Product'),'product');
					print $text.' '.nl2br($objp->description);

					// Show range
					print_date_range($db->jdate($objp->date_start),$db->jdate($objp->date_end));
					print "</td>\n";
				}

				// Qty ordered
				print '<td align="center">'.$objp->qty.'</td>';

				// Qty already shipped
				$qtyProdCom=$objp->qty;
				print '<td align="center">';
				// Nb of sending products for this line of order
				$quantite_livree = $commande->expeditions[$objp->rowid];
				print $quantite_livree;
				print '</td>';

				// Qty remains to ship
        } else {
            echo ($txt ? ' - ' : '') . dol_htmlentitiesbr($line->description);
        }
    }
} else {
    if (!empty($line->fk_parent_line)) {
        echo img_picto('', 'rightarrow');
    }
    if ($type == 1) {
        $text = img_object($langs->trans('Service'), 'service');
    } else {
        $text = img_object($langs->trans('Product'), 'product');
    }
    echo $text . ' ' . dol_htmlentitiesbr($line->description);
    // Show range
    print_date_range($line->date_start, $line->date_end);
}
?>
	</td>

	<td align="right" nowrap="nowrap"><?php 
echo vatrate($line->tva_tx, '%', $line->info_bits);
?>
</td>

	<td align="right" nowrap="nowrap"><?php 
echo price($line->subprice);
?>
</td>

	<td align="right" nowrap="nowrap">
 if ($action == 'edit_line' && $user->rights->fournisseur->commande->creer && $_GET["rowid"] == $line->id) {
     print "\n";
     print '<tr ' . $bc[$var] . '>';
     print '<td>';
     print '<input type="hidden" name="elrowid" value="' . $_GET['rowid'] . '">';
     print '<a name="' . $line->id . '"></a>';
     // ancre pour retourner sur la ligne
     if ((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && $line->fk_product > 0) {
         $product_static = new ProductFournisseur($db);
         $product_static->fetch_opt($line->fk_product);
         $text = $product_static->getNomUrl(1, 'supplier');
         $text .= ' - ' . $product_static->libelle;
         $description = $conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($line->description);
         print $form->textwithtooltip($text, $description, 3, '', '', $i);
         // Show range
         print_date_range($date_start, $date_end);
         print '<br>';
     } else {
         $forceall = 1;
         // For suppliers, we always show all types
         print $form->select_type_of_lines($line->product_type, 'type', 1, 0, $forceall);
         if ($forceall || !empty($conf->product->enabled) && !empty($conf->service->enabled) || empty($conf->product->enabled) && empty($conf->service->enabled)) {
             print '<br>';
         }
     }
     if (is_object($hookmanager)) {
         $parameters = array('fk_parent_line' => $line->fk_parent_line, 'line' => $line, 'var' => $var, 'num' => $num, 'i' => $i);
         $reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $object, $action);
     }
     $nbrows = ROWS_2;
     if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) {
Esempio n. 9
0
         print_date_range($fac->lines[$i]->date_start, $fac->lines[$i]->date_end);
         // Add description in form
         if ($conf->global->PRODUIT_DESC_IN_FORM) {
             print $fac->lines[$i]->desc && $fac->lines[$i]->desc != $fac->lines[$i]->libelle ? '<br>' . dol_htmlentitiesbr($fac->lines[$i]->desc) : '';
         }
         print '</td>';
     } else {
         print '<td>';
         if ($type == 1) {
             $text = img_object($langs->trans('Service'), 'service');
         } else {
             $text = img_object($langs->trans('Product'), 'product');
         }
         print $text . ' ' . nl2br($fac->lines[$i]->desc);
         // Show range
         print_date_range($fac->lines[$i]->date_start, $fac->lines[$i]->date_end);
         print '</td>';
     }
     print "<td align=\"right\">" . price($fac->lines[$i]->price) . "</td>";
     print '<td align="center">' . $fac->lines[$i]->remise_percent . ' %</td>';
     print "<td align=\"center\">" . $fac->lines[$i]->qty . "</td></tr>\n";
     $i++;
 }
 print '</table>';
 /**
  * Barre d'actions
  */
 print '<div class="tabsAction">';
 if ($fac->statut == 0 && $user->rights->facture->supprimer) {
     print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?action=delete&facid=' . $fac->id . '">' . $langs->trans('Delete') . '</a>';
 }