/**
	 * Return all leads grouped by status
	 *
	 * @param  int             $limit Limit results
	 * @return array|int       Array with value or -1 if error
	 * @throws Exception
	 */
	function getAllProjectByStatus($limit = 5)
	{
		global $conf, $user, $langs;

		$datay = array ();

		$sql = "SELECT";
		$sql .= " SUM(t.opp_amount), t.fk_opp_status, cls.code, cls.label";
		$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t, ".MAIN_DB_PREFIX."c_lead_status as cls";
		$sql .= $this->buildWhere();
		$sql .= " AND t.fk_opp_status = cls.rowid";
		$sql .= " AND t.fk_statut <> 0";     // We want historic also, so all projects
		$sql .= " GROUP BY t.fk_opp_status, cls.code, cls.label";

		$result = array ();
		$res = array ();

		dol_syslog(get_class($this) . '::' . __METHOD__ . "", LOG_DEBUG);
		$resql = $this->db->query($sql);
		if ($resql) {
			$num = $this->db->num_rows($resql);
			$i = 0;
			$other = 0;
			while ( $i < $num ) {
				$row = $this->db->fetch_row($resql);
				if ($i < $limit || $num == $limit)
				{
				    $label = (($langs->trans("OppStatus".$row[2]) != "OppStatus".$row[2]) ? $langs->trans("OppStatus".$row[2]) : $row[2]);
					$result[$i] = array(
						$label. ' (' . price(price2num($row[0], 'MT'), 1, $langs, 1, -1, -1, $conf->currency) . ')',
						$row[0]
					);
				}
				else
					$other += $row[1];
				$i++;
			}
			if ($num > $limit)
				$result[$i] = array (
						$langs->transnoentitiesnoconv("Other"),
						$other
				);
			$this->db->free($resql);
		} else {
			$this->error = "Error " . $this->db->lasterror();
			dol_syslog(get_class($this) . '::' . __METHOD__ . ' ' . $this->error, LOG_ERR);
			return -1;
		}

		return $result;
	}
Ejemplo n.º 2
0
 /**
  * Load data into info_box_contents array to show array later.
  *
  * @param int $max of records to load
  *
  * @return void
  */
 public function loadBox($max = 5)
 {
     global $conf, $user, $langs, $db;
     $this->max = $max;
     dol_include_once('/lead/class/lead.class.php');
     $lead = new Lead($db);
     $lead->fetch_all('DESC', 't.date_closure', $max, 0, array('t.date_closure<' => dol_now()));
     $text = $langs->trans("LeadLate", $max);
     $this->info_box_head = array('text' => $text, 'limit' => dol_strlen($text));
     $i = 0;
     foreach ($lead->lines as $line) {
         // FIXME: line is an array, not an object
         $line->fetch_thirdparty();
         // Ref
         $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => dol_buildpath('/lead/lead/card.php', 1) . '?id=' . $line->id);
         $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $line->ref, 'url' => dol_buildpath('/lead/lead/card.php', 1) . '?id=' . $line->id);
         $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', 'url' => DOL_URL_ROOT . "/comm/fiche.php?socid=" . $line->fk_soc);
         $this->info_box_contents[$i][3] = array('td' => 'align="left"', 'text' => dol_trunc($line->thirdparty->name, 40), 'url' => DOL_URL_ROOT . "/comm/fiche.php?socid=" . $line->fk_soc);
         // Amount Guess
         $this->info_box_contents[$i][4] = array('td' => 'align="left"', 'text' => price($line->amount_prosp, 'HTML') . $langs->getCurrencySymbol($conf->currency));
         // Amount real
         $this->info_box_contents[$i][5] = array('td' => 'align="left"', 'text' => $line->getRealAmount() . $langs->getCurrencySymbol($conf->currency));
         $i++;
     }
 }
Ejemplo n.º 3
0
function pt ($db, $sql, $date) {
  global $bc;

  $result = $db->query($sql);
  if ($result) {
    $num = $db->num_rows($result);
    $i = 0; $total = 0 ;
    print "<TABLE border=\"1\" width=\"100%\">";
    print "<TR class=\"liste_titre\">";
    print "<TD width=\"60%\">$date</TD>";
    print "<TD align=\"right\">Montant</TD>";
    print "<td>&nbsp;</td>\n";
    print "</TR>\n";
    $var=True;
    while ($i < $num) {
      $obj = $db->fetch_object($result);
      $var=!$var;
      print "<TR $bc[$var]>";
      print "<TD>$obj->dm</TD>\n";
      print "<TD align=\"right\">".price($obj->amount)."</TD><td>&nbsp;</td>\n";
      print "</TR>\n";

      $total = $total + $obj->amount;

      $i++;
    }
    print "<tr><td align=\"right\">".$langs->trans("TotalHT").":</td><td align=\"right\"><b>".price($total)."</b></td><td>".$langs->trans("Currency".$conf->monnaie)."</td></tr>";

    print "</table>";
    $db->free();
  }
}
Ejemplo n.º 4
0
/**
 * print function
 *
 * @param   DoliDB $db          Database
 * @param   string $sql     sql
 * @param   string $date    date
 * @return  void
 */
function pt($db, $sql, $date)
{
    global $conf, $bc, $langs;
    $result = $db->query($sql);
    if ($result) {
        $num = $db->num_rows($result);
        $i = 0;
        $total = 0;
        print '<table class="noborder" width="100%">';
        print '<tr class="liste_titre">';
        print '<td class="nowrap" width="60%">' . $date . '</td>';
        print '<td align="right">' . $langs->trans("Amount") . '</td>';
        print '<td>&nbsp;</td>' . "\n";
        print "</tr>\n";
        $var = True;
        while ($i < $num) {
            $obj = $db->fetch_object($result);
            $var = !$var;
            print '<tr ' . $bc[$var] . '>';
            print '<td class="nowrap">' . $obj->dm . "</td>\n";
            $total = $total + $obj->mm;
            print '<td class="nowrap" align="right">' . price($obj->mm) . "</td><td >&nbsp;</td>\n";
            print "</tr>\n";
            $i++;
        }
        print '<tr class="liste_total"><td align="right">' . $langs->trans("Total") . " :</td><td class=\"nowrap\" align=\"right\"><b>" . price($total) . "</b></td><td>&nbsp;</td></tr>";
        print "</table>";
        $db->free($result);
    } else {
        dol_print_error($db);
    }
}
Ejemplo n.º 5
0
 public function ydf_excel($date = NULL)
 {
     header("Content-Type: text/html; charset=gb2312");
     if ($date == NULL) {
         $date = date('Y-m-d');
     }
     $orders = $this->get_ydf_order($date);
     $head = array('Sales Record Number', 'Buyer Fullname', 'Buyer Company', 'Buyer Address 1', 'Buyer Address 2', 'Buyer City', 'Buyer State', 'Buyer Zip', 'Buyer Phone Number', 'Buyer Country', 'Custom Label', 'Description EN', 'Description CN', 'HS Code', 'Quantity', 'Sale Price', 'Country of Manufacture', 'Mark', 'weight', 'Length', 'Width', 'Height', 'Shipping Service', 'Shipping Service Name', 'Track Number');
     foreach ($orders as $order) {
         $skus = explode(',', $order->sku_str);
         $qties = explode(',', $order->qty_str);
         $shipping_method = shipping_method($order->is_register);
         //echo $order->id."<br>";
         $count = count($skus);
         $product_name = '';
         $product_name_en = '';
         $qty = 0;
         $weight = 0;
         $rmb = price($this->order_model->calc_currency($order->currency, $order->gross));
         for ($i = 0; $i < $count; $i++) {
             if ($i == 0) {
                 $product_name .= iconv("UTF-8", "GB2312//IGNORE", get_product_name($skus[$i]));
                 $product_name_en .= iconv("UTF-8", "GB2312//IGNORE", get_product_name_en($skus[$i]));
             }
             $qty += $qties[$i];
             $weight += get_weight_by_sku($skus[$i]) * $skus[$i];
         }
         $shipping_method_name_cn = iconv("UTF-8", "GB2312//IGNORE", $shipping_method->name_cn);
         $data[] = array($order->id, $order->name, " ", $order->address_line_1, $order->address_line_2, $order->town_city, $order->state_province, $order->zip_code, $order->contact_phone_number, $order->country, $skus[0], $product_name_en, $product_name, " ", $qty, $rmb, " ", " ", $weight, " ", " ", " ", $shipping_method->ydf_code, $shipping_method_name_cn, $order->track_number);
     }
     $this->excel->array_to_excel($data, $head, 'ydf_list_' . $date);
 }
Ejemplo n.º 6
0
 public function toArray()
 {
     $results = [];
     foreach ($this->getShipments() as $shipment) {
         foreach ($this->getMethods($shipment->address) as $rate) {
             $results[] = ['label' => $rate['title'] . ' - ' . price($rate['price']), 'name' => 'method', 'value' => $rate['code']];
         }
     }
     return $results;
 }
Ejemplo n.º 7
0
 /**
  * Build Select List of element associable to a businesscase
  *
  * @param string $tablename To parse
  * @param Lead $lead The lead
  * @param string $htmlname Name of the component
  *
  * @return string HTML select list of element
  */
 function select_element($tablename, $lead, $htmlname = 'elementselect')
 {
     global $langs, $conf;
     switch ($tablename) {
         case "facture":
             $sql = "SELECT rowid, facnumber as ref, total as total_ht, date_valid as date_element";
             break;
         case "contrat":
             $sql = "SELECT rowid, ref as ref, 0 as total_ht, date_contrat as date_element";
             break;
         case "commande":
             $sql = "SELECT rowid, ref as ref, total_ht as total_ht, date_commande as date_element";
             break;
         default:
             $sql = "SELECT rowid, ref, total_ht, datep as date_element";
             break;
     }
     $sql .= " FROM " . MAIN_DB_PREFIX . $tablename;
     //TODO Fix sourcetype can be different from tablename (exemple project/projet)
     $sql .= " WHERE rowid NOT IN (SELECT fk_source FROM " . MAIN_DB_PREFIX . "element_element WHERE targettype='" . $lead->element . "' AND sourcetype='" . $tablename . "')";
     // Manage filter
     /*if (count($filter) > 0) {
     			foreach ( $filter as $key => $value ) {
     				if (($key == 's.fk_session_place') || ($key == 'f.rowid') || ($key == 's.type_session') || ($key == 's.status') || ($key == 'sale.fk_user_com')) {
     					$sql .= ' AND ' . $key . ' = ' . $value;
     				} else {
     					$sql .= ' AND ' . $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
     				}
     			}
     		}*/
     $sql .= " AND fk_soc=" . $lead->fk_soc;
     $sql .= " AND entity=" . $conf->entity;
     // $sql.= " AND entity IN (".getEntity($object->element,1).")";
     $sql .= " ORDER BY ref DESC";
     dol_syslog(get_class($this) . "::select_element sql=" . $sql, LOG_DEBUG);
     $resql = $this->db->query($sql);
     if ($resql) {
         $num = $this->db->num_rows($resql);
         $i = 0;
         if ($num > 0) {
             $sellist = '<select class="flat" name="' . $htmlname . '">';
             while ($i < $num) {
                 $obj = $this->db->fetch_object($resql);
                 $sellist .= '<option value="' . $obj->rowid . '">' . $obj->ref . ' (' . dol_print_date($this->db->jdate($obj->date_element), 'daytextshort') . ')';
                 $sellist .= (empty($obj->total_ht) ? '' : '-' . price($obj->total_ht) . $langs->getCurrencySymbol($conf->currency)) . '</option>';
                 $i++;
             }
             $sellist .= '</select>';
         }
         return $sellist;
     }
     $this->db->free($resql);
     return null;
 }
function _get_percent($qty, $qty_used)
{
    $percent = ($qty_used - $qty) / $qty * 100;
    $color = '';
    if ($percent > 0.5) {
        $color = 'red';
    } else {
        if ($percent < -0.5) {
            $color = 'orange';
        }
    }
    return '<span style="color:' . $color . ';">' . price($percent, '', '', 1, 2, 2) . '%</span>';
}
function _updateLine($objectid, $objectelement, $lineid, $column, $value)
{
    global $db, $conf, $langs;
    ${$column} = price2num($value);
    $Tab = array();
    $o = new $objectelement($db);
    $o->fetch($objectid);
    $find = false;
    foreach ($o->lines as &$line) {
        if ($line->id == $lineid || $line->rowid == $lineid) {
            $find = true;
            break;
        }
    }
    if ($find) {
        if (is_null($qty)) {
            $qty = $line->qty;
        }
        if (is_null($price)) {
            $price = $line->subprice;
        }
        if (is_null($remise_percent)) {
            $remise_percent = $line->remise_percent;
        }
        if ($objectelement == 'facture') {
            $res = $o->updateline($lineid, $line->desc, $price, $qty, $remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
            $total_ht = $o->line->total_ht;
            $uttc = $o->line->subprice + $o->line->subprice * $o->line->tva_tx / 100;
        } else {
            if ($objectelement == 'commande') {
                $res = $o->updateline($lineid, $line->desc, $price, $qty, $remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->date_start, $line->date_end, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->fk_unit);
                $total_ht = $o->line->total_ht;
                $uttc = $o->line->subprice + $o->line->subprice * $o->line->tva_tx / 100;
            } else {
                $res = $o->updateline($lineid, $price, $qty, $remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit);
                $total_ht = $o->line->total_ht;
                $uttc = $o->line->subprice + $o->line->subprice * $o->line->tva_tx / 100;
            }
        }
        if ($res > 0) {
            $Tab = array('total_ht' => price($total_ht), 'qty' => $qty, 'price' => price($price), 'remise_percent' => $remise_percent, 'uttc' => $uttc);
        } else {
            $Tab = array('error' => 'updateFailed', 'msg' => $o->error);
        }
    } else {
        $Tab = array('error' => 'noline');
    }
    return $Tab;
}
Ejemplo n.º 10
0
 function voucher_summary($validity, $currency, $value)
 {
     if ($validity != 2 && $validity != '0') {
         $return = '';
         $return .= '<div class="row row-5">';
         $return .= '<div class="col-xs-12"><p>Voucher</p></div>';
         $return .= '<div class="col-xs-12">';
         $return .= '<p class="amount">' . $currency . price(CURRENCY, $value) . '</p>';
         $return .= '</div>';
         $return .= '</div>';
     } else {
         $return = '';
     }
     echo $return;
 }
Ejemplo n.º 11
0
 function voucher_summary($validity, $currency, $value)
 {
     if ($currency == 1) {
         $currency = 'Rp.';
     } else {
         $currency = 'USD$';
     }
     if ($validity != 2 && $validity != '0') {
         $return = '';
         $return .= '<div class="col-sm-8"><p>Voucher</p></div>';
         $return .= '<div class="col-sm-4">';
         $return .= '<p class="amount">' . $currency . price(CURRENCY, $value) . '</p>';
         $return .= '</div>';
     } else {
         $return = '';
     }
     echo $return;
 }
Ejemplo n.º 12
0
 public function update_payment_cost()
 {
     $id = $this->input->post('id');
     $type = $this->input->post('type');
     $value = trim($this->input->post('value'));
     $item_cost = $this->purchase_finance_model->fetch_purchase_order($id)->item_cost;
     $costs = $this->purchase_finance_model->fetch_payment_cost($id);
     $payment_costs = isset($costs->payment_cost) ? $costs->payment_cost : '0';
     $total_costs = price($payment_costs + $value);
     try {
         $payment_state = $this->purchase_finance_model->fetch_purchase_order($id)->payment_state;
         if ($payment_state == 0) {
             $skus_object = $this->purchase_order_model->fetch_all_sku_by_purchase_order_id($id);
             foreach ($skus_object as $row) {
                 $count = on_way_count($row->sku);
                 $data_product = array('on_way_count' => $count);
                 $this->product_model->update_product_by_sku($row->sku, $data_product);
             }
         }
         if (!is_numeric($value) || $value < 0) {
             echo $this->create_json(0, lang('your_input_is_not_positive_numeric'), $value);
             return;
         }
         if ($total_costs > $item_cost) {
             echo $this->create_json(0, lang('your_input_is_not_range_numeric'), $value);
             return;
         } else {
             //                $completed_id = fetch_status_id('review_state', 'completed');
             $data1 = array('purchase_order_id' => $id, 'payment_cost' => price($value));
             if ($total_costs > 0 && $total_costs < $item_cost) {
                 $data = array('payment_state' => '2');
             }
             if ($total_costs == price($item_cost)) {
                 $data = array('payment_state' => '3');
             }
             $this->purchase_finance_model->add_purchase_payment($data1);
             $this->purchase_order_model->review_reject_order($id, $data);
             echo $this->create_json(1, lang('ok'), $value);
         }
     } catch (Exception $e) {
         $this->ajax_failed();
         echo lang('error_msg');
     }
 }
Ejemplo n.º 13
0
 public function edit_save()
 {
     $rules = array(array('field' => 'name_cn', 'label' => lang('chinese_name'), 'rules' => 'trim|required'), array('field' => 'name_en', 'label' => lang('english_name'), 'rules' => 'trim|required'), array('field' => 'image_url', 'label' => lang('image_url'), 'rules' => 'trim|is_url'), array('field' => 'length', 'label' => lang('length'), 'rules' => 'trim|required|positive_numeric'), array('field' => 'width', 'label' => lang('width'), 'rules' => 'trim|required|positive_numeric'), array('field' => 'height', 'label' => lang('height'), 'rules' => 'trim|required|positive_numeric'), array('field' => 'weight', 'label' => lang('weight'), 'rules' => 'trim|required|positive_numeric'), array('field' => 'content', 'label' => lang('content'), 'rules' => 'trim|required|positive_numeric'), array('field' => 'cost', 'label' => lang('packing_cost'), 'rules' => 'trim|required|positive_numeric'));
     $this->form_validation->set_rules($rules);
     if ($this->form_validation->run() == FALSE) {
         $error = validation_errors();
         echo $this->create_json(0, $error);
         return;
     }
     $data = array('name_cn' => trim($this->input->post('name_cn')), 'name_en' => trim($this->input->post('name_en')), 'image_url' => trim($this->input->post('image_url')), 'length' => trim($this->input->post('length')), 'width' => trim($this->input->post('width')), 'height' => trim($this->input->post('height')), 'weight' => trim($this->input->post('weight')), 'content' => trim($this->input->post('content')), 'cost' => price(trim($this->input->post('cost'))));
     try {
         $id = $this->input->post('packing_id');
         $this->product_packing_model->update_product_packing($id, $data);
         echo $this->create_json(1, lang('product_packing_saved'));
     } catch (Exception $e) {
         echo lang('error_msg');
         $this->ajax_failed();
     }
 }
Ejemplo n.º 14
0
function pt ($db, $sql, $title) {
  global $bc;
  global $langs,$conf;

  print '<table class="border" width="100%">';
  print '<tr class="liste_titre">';
  print "<td>$title</td>";
  print "<td align=\"right\">Montant</td>";
  print "</tr>\n";

  $result = $db->query($sql);
  if ($result)
    {
      $num = $db->num_rows($result);
      $i = 0; $total = 0 ;

      $var=True;
      while ($i < $num)
	{
	  $obj = $db->fetch_object($result);
	  $var=!$var;
	  print '<tr '.$bc[$var].'>';
	  print '<td>'.$obj->dm.'</td>';
	  print '<td align="right">'.price($obj->amount).'</td>';

	  print "</tr>\n";
	  $total = $total + $obj->amount;
	  $i++;
	}
      print "<tr class=\"total\"><td colspan=\"2\" align=\"right\"><b>".$langs->trans("TotalHT").": ".price($total)."</b> ".$langs->trans("Currency".$conf->monnaie)."</td></tr>";

      $db->free();
    }
  else
    {
      dol_print_error($db);

    }
  print "</table>";

}
Ejemplo n.º 15
0
function pt ($db, $sql, $date)
{
    global $conf, $bc,$langs;

    $result = $db->query($sql);
    if ($result)
    {
        $num = $db->num_rows($result);
        $i = 0;
        $total = 0;
        print "<table class=\"noborder\" width=\"100%\">";
        print "<tr class=\"liste_titre\">";
        print "<td nowrap width=\"60%\">$date</td>";
        print "<td align=\"right\">".$langs->trans("Amount")."</td>";
        print "<td>&nbsp;</td>\n";
        print "</tr>\n";
        $var=True;
        while ($i < $num)
        {
            $obj = $db->fetch_object($result);
            $var=!$var;
            print "<tr $bc[$var]>";
            print "<td nowrap>$obj->dm</td>\n";
            $total = $total + $obj->mm;

            print "<td nowrap align=\"right\">".price($obj->mm)."</td><td >&nbsp;</td>\n";
            print "</tr>\n";

            $i++;
        }
        print "<tr class=\"liste_total\"><td align=\"right\">".$langs->trans("Total")." :</td><td nowrap align=\"right\"><b>".price($total)."</b></td><td>&nbsp;</td></tr>";

        print "</table>";
        $db->free($result);
    }
    else {
        dolibar_print_error($db);
    }
}
Ejemplo n.º 16
0
 function lists($select = '*', $where = '', $ordering = '', $limit = '', $other = '')
 {
     if ($where != '') {
         $where = ' && ' . $where;
     }
     $where = 'p.lang = ' . $_SESSION['lang'] . $where;
     $select = str_replace(',', ',p.', $select);
     if ($ordering == '') {
         $ordering = 'p.special DESC';
     }
     if ($other != '') {
         $cha = new channel_pro();
         $cat = new category_pro();
         $select = $select . ',cha.cha_id,cha.name as cha_name,cat.cat_id,cat.name as cat_name';
         $other = " LEFT JOIN " . $cha->table . " as cha ON cha.cha_id = p.cha_id\n\t\t\t\t\tLEFT JOIN " . $cat->table . " as cat ON cat.cat_id = p.cat_id";
     }
     $result = $this->db->lists($this->table . ' AS p', 'p.' . $select, $where, $ordering, $limit, $other);
     $i = 0;
     while ($row = $this->db->fetch_assoc($result)) {
         $list[$i]->pro_id = $row[$this->key];
         $list[$i]->cha_name = $row['cha_name'];
         $list[$i]->cat_name = $row['cat_name'];
         $list[$i]->name = $row['name'];
         $list[$i]->ordering = $row['ordering'];
         $list[$i]->alias = $row['alias'];
         $list[$i]->price = price($row['price']);
         $list[$i]->description = $row['description'];
         $list[$i]->color = $row['hit'];
         $list[$i]->date_up = $row['date_up'];
         $list[$i]->image = $row['image'];
         $list[$i]->status = $row['status'];
         $list[$i]->special = $row['special'];
         $list[$i]->link_demo = $row['link_demo'];
         $i++;
     }
     $this->db->free_result($result);
     return $list;
 }
Ejemplo n.º 17
0
             if ($user->rights->stock->creer) {
                 print '<td align="center"><a href="' . DOL_URL_ROOT . '/product/stock/product.php?dwid=' . $object->id . '&amp;id=' . $objp->rowid . '&amp;action=correction">';
                 print $langs->trans("StockCorrection");
                 print "</a></td>";
             }
             print "</tr>";
             $i++;
         }
         $db->free($resql);
         print '<tr class="liste_total"><td class="liste_total" colspan="2">' . $langs->trans("Total") . '</td>';
         print '<td class="liste_total" align="right">' . $totalunit . '</td>';
         print '<td class="liste_total">&nbsp;</td>';
         print '<td class="liste_total" align="right">' . price(price2num($totalvalue, 'MT')) . '</td>';
         if (empty($conf->global->PRODUIT_MULTIPRICES)) {
             print '<td class="liste_total">&nbsp;</td>';
             print '<td class="liste_total" align="right">' . price(price2num($totalvaluesell, 'MT')) . '</td>';
         }
         print '<td class="liste_total">&nbsp;</td>';
         print '<td class="liste_total">&nbsp;</td>';
         print '</tr>';
     } else {
         dol_print_error($db);
     }
     print "</table>\n";
 }
 /*
  * Edition fiche
  */
 if (($action == 'edit' || $action == 're-edit') && 1) {
     print_fiche_titre($langs->trans("WarehouseEdit"), $mesg);
     print '<form action="fiche.php" method="POST">';
Ejemplo n.º 18
0
 /**
  * Return HTML string to put an output field into a page
  *
  * @param   string	$key            Key of attribute
  * @param   string	$value          Value to show
  * @param	string	$moreparam		To add more parametes on html input tag (only checkbox use html input for output rendering)
  * @return	string					Formated value
  */
 function showOutputField($key, $value, $moreparam = '')
 {
     global $conf, $langs;
     $label = $this->attribute_label[$key];
     $type = $this->attribute_type[$key];
     $size = $this->attribute_size[$key];
     $elementtype = $this->attribute_elementtype[$key];
     $unique = $this->attribute_unique[$key];
     $required = $this->attribute_required[$key];
     $params = $this->attribute_param[$key];
     $perms = $this->attribute_perms[$key];
     $list = $this->attribute_list[$key];
     $showsize = 0;
     if ($type == 'date') {
         $showsize = 10;
         $value = dol_print_date($value, 'day');
     } elseif ($type == 'datetime') {
         $showsize = 19;
         $value = dol_print_date($value, 'dayhour');
     } elseif ($type == 'int') {
         $showsize = 10;
     } elseif ($type == 'double') {
         if (!empty($value)) {
             $value = price($value);
         }
     } elseif ($type == 'boolean') {
         $checked = '';
         if (!empty($value)) {
             $checked = ' checked ';
         }
         $value = '<input type="checkbox" ' . $checked . ' ' . ($moreparam ? $moreparam : '') . ' readonly disabled>';
     } elseif ($type == 'mail') {
         $value = dol_print_email($value);
     } elseif ($type == 'phone') {
         $value = dol_print_phone($value);
     } elseif ($type == 'price') {
         $value = price($value, 0, $langs, 0, 0, -1, $conf->currency);
     } elseif ($type == 'select') {
         $value = $params['options'][$value];
     } elseif ($type == 'sellist') {
         $param_list = array_keys($params['options']);
         $InfoFieldList = explode(":", $param_list[0]);
         $selectkey = "rowid";
         $keyList = 'rowid';
         if (count($InfoFieldList) >= 3) {
             $selectkey = $InfoFieldList[2];
             $keyList = $InfoFieldList[2] . ' as rowid';
         }
         $fields_label = explode('|', $InfoFieldList[1]);
         if (is_array($fields_label)) {
             $keyList .= ', ';
             $keyList .= implode(', ', $fields_label);
         }
         $sql = 'SELECT ' . $keyList;
         $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0];
         if (strpos($InfoFieldList[4], 'extra') !== false) {
             $sql .= ' as main';
         }
         $sql .= " WHERE " . $selectkey . "='" . $this->db->escape($value) . "'";
         //$sql.= ' AND entity = '.$conf->entity;
         dol_syslog(get_class($this) . ':showOutputField:$type=sellist', LOG_DEBUG);
         $resql = $this->db->query($sql);
         if ($resql) {
             $value = '';
             // value was used, so now we reste it to use it to build final output
             $obj = $this->db->fetch_object($resql);
             // Several field into label (eq table:code|libelle:rowid)
             $fields_label = explode('|', $InfoFieldList[1]);
             if (is_array($fields_label) && count($fields_label) > 1) {
                 foreach ($fields_label as $field_toshow) {
                     $translabel = '';
                     if (!empty($obj->{$field_toshow})) {
                         $translabel = $langs->trans($obj->{$field_toshow});
                     }
                     if ($translabel != $field_toshow) {
                         $value .= dol_trunc($translabel, 18) . ' ';
                     } else {
                         $value .= $obj->{$field_toshow} . ' ';
                     }
                 }
             } else {
                 $translabel = '';
                 if (!empty($obj->{$InfoFieldList}[1])) {
                     $translabel = $langs->trans($obj->{$InfoFieldList}[1]);
                 }
                 if ($translabel != $obj->{$InfoFieldList}[1]) {
                     $value = dol_trunc($translabel, 18);
                 } else {
                     $value = $obj->{$InfoFieldList}[1];
                 }
             }
         } else {
             dol_syslog(get_class($this) . '::showOutputField error ' . $this->db->lasterror(), LOG_WARNING);
         }
     } elseif ($type == 'radio') {
         $value = $params['options'][$value];
     } elseif ($type == 'checkbox') {
         $value_arr = explode(',', $value);
         $value = '';
         if (is_array($value_arr)) {
             foreach ($value_arr as $keyval => $valueval) {
                 $value .= $params['options'][$valueval] . '<br>';
             }
         }
     } elseif ($type == 'chkbxlst') {
         $value_arr = explode(',', $value);
         $param_list = array_keys($params['options']);
         $InfoFieldList = explode(":", $param_list[0]);
         $selectkey = "rowid";
         $keyList = 'rowid';
         if (count($InfoFieldList) >= 3) {
             $selectkey = $InfoFieldList[2];
             $keyList = $InfoFieldList[2] . ' as rowid';
         }
         $fields_label = explode('|', $InfoFieldList[1]);
         if (is_array($fields_label)) {
             $keyList .= ', ';
             $keyList .= implode(', ', $fields_label);
         }
         $sql = 'SELECT ' . $keyList;
         $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0];
         if (strpos($InfoFieldList[4], 'extra') !== false) {
             $sql .= ' as main';
         }
         // $sql.= " WHERE ".$selectkey."='".$this->db->escape($value)."'";
         // $sql.= ' AND entity = '.$conf->entity;
         dol_syslog(get_class($this) . ':showOutputField:$type=chkbxlst', LOG_DEBUG);
         $resql = $this->db->query($sql);
         if ($resql) {
             $value = '';
             // value was used, so now we reste it to use it to build final output
             while ($obj = $this->db->fetch_object($resql)) {
                 // Several field into label (eq table:code|libelle:rowid)
                 $fields_label = explode('|', $InfoFieldList[1]);
                 if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) {
                     if (is_array($fields_label) && count($fields_label) > 1) {
                         foreach ($fields_label as $field_toshow) {
                             $translabel = '';
                             if (!empty($obj->{$field_toshow})) {
                                 $translabel = $langs->trans($obj->{$field_toshow});
                             }
                             if ($translabel != $field_toshow) {
                                 $value .= dol_trunc($translabel, 18) . '<BR>';
                             } else {
                                 $value .= $obj->{$field_toshow} . '<BR>';
                             }
                         }
                     } else {
                         $translabel = '';
                         if (!empty($obj->{$InfoFieldList}[1])) {
                             $translabel = $langs->trans($obj->{$InfoFieldList}[1]);
                         }
                         if ($translabel != $obj->{$InfoFieldList}[1]) {
                             $value .= dol_trunc($translabel, 18) . '<BR>';
                         } else {
                             $value .= $obj->{$InfoFieldList}[1] . '<BR>';
                         }
                     }
                 }
             }
         } else {
             dol_syslog(get_class($this) . '::showOutputField error ' . $this->db->lasterror(), LOG_WARNING);
         }
     } elseif ($type == 'link') {
         $out = '';
         // only if something to display (perf)
         if ($value) {
             $param_list = array_keys($params['options']);
             // 0 : ObjectName
             // 1 : classPath
             $InfoFieldList = explode(":", $param_list[0]);
             dol_include_once($InfoFieldList[1]);
             if ($InfoFieldList[0] && class_exists($InfoFieldList[0])) {
                 $object = new $InfoFieldList[0]($this->db);
                 $object->fetch($value);
                 $value = $object->getNomUrl(3);
             } else {
                 dol_syslog('Error bad setup of extrafield', LOG_WARNING);
                 $out .= 'Error bad setup of extrafield';
             }
         }
     } elseif ($type == 'text') {
         $value = dol_htmlentitiesbr($value);
     } else {
         $showsize = round($size);
         if ($showsize > 48) {
             $showsize = 48;
         }
     }
     //print $type.'-'.$size;
     $out = $value;
     return $out;
 }
Ejemplo n.º 19
0
        }
        print '<td align="right">' . price(price2num($subtot_paye_total_ht, 'MT')) . '</td>';
        print '<td class="nowrap" align="right">' . price(price2num($subtot_paye_vat, 'MT')) . '</td>';
        print '</tr>';
    }
    if (count($x_paye) == 0) {
        print '<tr class="liste_total">';
        print '<td>&nbsp;</td>';
        print '<td align="right">' . $langs->trans("Total") . ':</td>';
        if ($modetax == 0) {
            print '<td class="nowrap" align="right">&nbsp;</td>';
            print '<td align="right">&nbsp;</td>';
        }
        print '<td align="right">' . price(price2num(0, 'MT')) . '</td>';
        print '<td class="nowrap" align="right">' . price(price2num(0, 'MT')) . '</td>';
        print '</tr>';
    }
    print '</table>';
    // Total to pay
    print '<br><br>';
    print '<table class="noborder" width="100%">';
    $diff = $x_coll_sum - $x_paye_sum;
    print '<tr class="liste_total">';
    print '<td class="liste_total" colspan="' . $span . '">' . $langs->trans("TotalToPay") . ($q ? ', ' . $langs->trans("Quadri") . ' ' . $q : '') . '</td>';
    print '<td class="liste_total nowrap" align="right"><b>' . price(price2num($diff, 'MT')) . "</b></td>\n";
    print "</tr>\n";
    $i++;
}
echo '</table>';
llxFooter();
$db->close();
Ejemplo n.º 20
0
	/**
	 *  Show payments table
	 *  @param      pdf     		Object PDF
	 *  @param      object     		Object invoice
	 *	@param		posy			Position y in PDF
	 *	@param		outputlangs		Object langs for output
	 *	@return 	int				<0 if KO, >0 if OK
	 */
	function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
	{
		$tab3_posx = 120;
		$tab3_top = $posy + 8;
		$tab3_width = 80;
		$tab3_height = 4;

		$default_font_size = pdf_getPDFFontSize($outputlangs);

		$pdf->SetFont('','', $default_font_size - 2);
		$pdf->SetXY ($tab3_posx, $tab3_top - 5);
		$pdf->MultiCell(60, 5, $outputlangs->transnoentities("PaymentsAlreadyDone"), 0, 'L', 0);

		$pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height);

		$pdf->SetFont('','', $default_font_size - 4);
		$pdf->SetXY ($tab3_posx, $tab3_top );
		$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Payment"), 0, 'L', 0);
		$pdf->SetXY ($tab3_posx+21, $tab3_top );
		$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Amount"), 0, 'L', 0);
		$pdf->SetXY ($tab3_posx+40, $tab3_top );
		$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Type"), 0, 'L', 0);
		$pdf->SetXY ($tab3_posx+58, $tab3_top );
		$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Num"), 0, 'L', 0);

		$y=0;

		$pdf->SetFont('','', $default_font_size - 4);

		// Loop on each payment
		$sql = "SELECT p.datep as date, p.fk_paiement as type, p.num_paiement as num, pf.amount as amount,";
		$sql.= " cp.code";
		$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf, ".MAIN_DB_PREFIX."paiementfourn as p";
		$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id";
		$sql.= " WHERE pf.fk_paiementfourn = p.rowid and pf.fk_facturefourn = ".$object->id;
		$sql.= " ORDER BY p.datep";
		$resql=$this->db->query($sql);
		if ($resql)
		{
		    $num = $this->db->num_rows($resql);
			$i=0;
			while ($i < $num) {
			    $y+=3;
				$row = $this->db->fetch_object($resql);

				$pdf->SetXY ($tab3_posx, $tab3_top+$y );
				$pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($row->date),'day',false,$outputlangs,true), 0, 'L', 0);
				$pdf->SetXY ($tab3_posx+21, $tab3_top+$y);
				$pdf->MultiCell(20, 3, price($row->amount), 0, 'L', 0);
				$pdf->SetXY ($tab3_posx+40, $tab3_top+$y);
				$oper = $outputlangs->getTradFromKey("PaymentTypeShort" . $row->code);

				$pdf->MultiCell(20, 3, $oper, 0, 'L', 0);
				$pdf->SetXY ($tab3_posx+58, $tab3_top+$y);
				$pdf->MultiCell(30, 3, $row->num, 0, 'L', 0);

				$pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3 );

				$i++;
			}
		}
		else
		{
			$this->error=$this->db->lasterror();
			dol_syslog($this->db,$this->error, LOG_ERR);
			return -1;
		}

	}
Ejemplo n.º 21
0
    ?>
" width="100%">
				</div>
				<div class="info">
					<p class="title"><?php 
    echo $featured->product_name;
    ?>
</p>
					<p class="price">

						<?php 
    if (!empty($featured->promo_id) && $featured->promo_id != '' && $featured->promo_start_datetime <= date('Y-m-d') && $featured->promo_end_datetime >= date('Y-m-d')) {
        echo '<span class="now-price">' . $currency . price(CURRENCY, $discount['now_price']) . ' </span>';
        echo '<span class="was-price">' . $currency . price(CURRENCY, $discount['was_price']) . '</span>';
    } else {
        echo '<span class="normal-price">' . $currency . price(CURRENCY, $discount['now_price']) . '</span>';
    }
    ?>
                
                  	</p>
                </div>
              </a>
            </div><!--.thumb-->
		  
		    <?php 
}
?>
          </div><!--.row-->
	    </div><!--.container-->
	  </div><!--.featured-items-->
    </div>
Ejemplo n.º 22
0
    ?>
">
		</td>
	    <?php 
    if ($user->rights->margins->creer) {
        if (!empty($conf->global->DISPLAY_MARGIN_RATES)) {
            $margin_rate = isset($_POST["np_marginRate"]) ? $_POST["np_marginRate"] : ($line->pa_ht == 0 ? '' : price($line->marge_tx));
            // if credit note, dont allow to modify margin
            if ($line->subprice < 0) {
                echo '<td align="right" class="nowrap margininfos">' . $margin_rate . '<span class="hideonsmartphone">%</span></td>';
            } else {
                echo '<td align="right" class="nowrap margininfos"><input type="text" size="2" name="np_marginRate" value="' . $margin_rate . '"><span class="hideonsmartphone">%</span></td>';
            }
            $coldisplay++;
        } elseif (!empty($conf->global->DISPLAY_MARK_RATES)) {
            $mark_rate = isset($_POST["np_markRate"]) ? $_POST["np_markRate"] : price($line->marque_tx);
            // if credit note, dont allow to modify margin
            if ($line->subprice < 0) {
                echo '<td align="right" class="nowrap margininfos">' . $mark_rate . '<span class="hideonsmartphone">%</span></td>';
            } else {
                echo '<td align="right" class="nowrap margininfos"><input type="text" size="2" name="np_markRate" value="' . $mark_rate . '"><span class="hideonsmartphone">%</span></td>';
            }
            $coldisplay++;
        }
    }
}
?>

	<!-- colspan=4 for this td because it replace total_ht+3 td for buttons -->
	<td align="center" colspan="<?php 
echo $colspan;
Ejemplo n.º 23
0
<?php

$head = array('SKU', lang('total_refundment_list'), lang('total_order_count'), lang('percent_of_qty_refundment'));
$all_return = 0;
$all_total = 0;
foreach ($return_skus as $sku => $count) {
    $total_count = $skus[$sku];
    $retrun_rate = price($count / $total_count * 100) . '%';
    $all_return += $count;
    $all_total += $total_count;
    $data[] = array($sku, $count, $total_count, $retrun_rate);
}
if ($all_total == 0) {
    $all_rate = 0;
} else {
    $all_rate = price($all_return / $all_total * 100) . "%";
}
$data[] = array(lang('statistics'), $all_return, $all_total, $all_rate);
$sortable[] = 'integer';
$sortable[] = 'integer';
$title = lang('received_partial_refunded_statistics') . "-" . lang('by_sku');
echo block_header($title);
echo "<br>";
echo form_open(current_url());
echo lang('from') . ' ' . block_time_picker('begin_time', $begin_time) . '&nbsp;&nbsp;';
echo lang('to') . ' ' . block_time_picker('end_time', $end_time) . '&nbsp;&nbsp;';
$users = array();
foreach ($input_users as $input_user) {
    $users[$input_user->input_user] = $input_user->input_user;
}
$users = array_merge(array(lang('all_input_user')), $users);
Ejemplo n.º 24
0
                print '</td></tr></table>';
                print "</td>";
                $companystatic->id = $obj->socid;
                $companystatic->name = $obj->socname;
                $companystatic->client = $obj->client;
                $companystatic->canvas = $obj->canvas;
                print '<td align="left">' . $companystatic->getNomUrl(1, 'customer', 44) . '</td>' . "\n";
                print '<td align="right">';
                print dol_print_date($db->jdate($obj->dp), 'day') . '</td>' . "\n";
                print '<td align="right">' . price($obj->total_ttc) . '</td>';
                print '<td align="center" width="14">' . $supplier_proposalstatic->LibStatut($obj->fk_statut, 3) . '</td>' . "\n";
                print '</tr>' . "\n";
                $i++;
                $total += $obj->total_ttc;
            }
            if ($num > $nbofloop) {
                print '<tr class="liste_total"><td colspan="5">' . $langs->trans("XMoreLines", $num - $nbofloop) . "</td></tr>";
            } else {
                if ($total > 0) {
                    print '<tr class="liste_total"><td colspan="3">' . $langs->trans("Total") . "</td><td align=\"right\">" . price($total) . "</td><td>&nbsp;</td></tr>";
                }
            }
            print "</table><br>";
        }
    } else {
        dol_print_error($db);
    }
}
print '</div></div></div>';
llxFooter();
$db->close();
Ejemplo n.º 25
0
print '<td>' . $langs->trans("Subscriptions") . '</td>';
print '<td align="right">' . $langs->trans("Number") . '</td>';
print '<td align="right">' . $langs->trans("AmountTotal") . '</td>';
print '<td align="right">' . $langs->trans("AmountAverage") . '</td>';
print "</tr>\n";
$var = true;
krsort($Total);
foreach ($Total as $key => $value) {
    $var = !$var;
    print "<tr {$bc[$var]}>";
    print "<td><a href=\"adherent/cotisations.php?date_select={$key}\">{$key}</a></td>";
    print "<td align=\"right\">" . $Number[$key] . "</td>";
    print "<td align=\"right\">" . price($value) . "</td>";
    print "<td align=\"right\">" . price(price2num($value / $Number[$key], 'MT')) . "</td>";
    $numb += $Number[$key];
    $tot += $value;
    print "</tr>\n";
}
// Total
print '<tr class="liste_total">';
print '<td>' . $langs->trans("Total") . '</td>';
print "<td align=\"right\">" . $numb . "</td>";
print '<td align="right">' . price($tot) . "</td>";
print "<td align=\"right\">" . price(price2num($numb > 0 ? $tot / $numb : 0, 'MT')) . "</td>";
print "</tr>\n";
print "</table><br>\n";
print '</td></tr>';
print '</table>';
print dol_fiche_end();
llxFooter();
$db->close();
Ejemplo n.º 26
0
         }
     }
     print '</td>';
 }
 // Better buy price
 if (!empty($arrayfields['p.minbuyprice']['checked'])) {
     print '<td align="right">';
     if ($objp->tobuy && $objp->minsellprice != '') {
         //print price($objp->minsellprice).' '.$langs->trans("HT");
         if ($product_fourn->find_min_price_product_fournisseur($objp->rowid) > 0) {
             if ($product_fourn->product_fourn_price_id > 0) {
                 if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) {
                     $htmltext = $product_fourn->display_price_product_fournisseur(1, 1, 0, 1);
                     print $form->textwithpicto(price($product_fourn->fourn_unitprice) . ' ' . $langs->trans("HT"), $htmltext);
                 } else {
                     print price($product_fourn->fourn_unitprice) . ' ' . $langs->trans("HT");
                 }
             }
         }
     }
     print '</td>';
 }
 if (!empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) {
     if ($objp->fk_product_type != 1) {
         $product_static->id = $objp->rowid;
         $product_static->load_stock();
     }
 }
 // Desired stock
 if (!empty($arrayfields['p.desiredstock']['checked'])) {
     print '<td align="right">';
Ejemplo n.º 27
0
            $chargesociale_static->lib = $obj->id;
            $chargesociale_static->ref = $obj->id;
            print $chargesociale_static->getNomUrl(1, '20');
            print '</td>';
            // Label
            print '<td>' . dol_trunc($obj->libelle, 42) . '</td>';
            // Type
            print '<td>' . dol_trunc($obj->type_lib, 16) . '</td>';
            // Date end period
            print '<td align="center">';
            if ($obj->periode) {
                print '<a href="index.php?year=' . strftime("%Y", $db->jdate($obj->periode)) . '">' . dol_print_date($db->jdate($obj->periode), 'day') . '</a>';
            } else {
                print '&nbsp;';
            }
            print '</td>';
            print '<td align="right" width="100">' . price($obj->amount) . '</td>';
            // Due date
            print '<td width="110" align="center">' . dol_print_date($db->jdate($obj->date_ech), 'day') . '</td>';
            print '<td align="right" class="nowrap">' . $chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed) . '</a></td>';
            print '</tr>';
            $i++;
        }
        print '</table>';
        print '</form>';
    }
} else {
    dol_print_error($db);
}
$db->close();
llxFooter();
Ejemplo n.º 28
0
 /**
  *	Show total to pay
  *
  *	@param	PDF			$pdf           Object PDF
  *	@param  Facture		$object         Object invoice
  *	@param  int			$deja_regle     Montant deja regle
  *	@param	int			$posy			Position depart
  *	@param	Translate	$outputlangs	Objet langs
  *	@return int							Position pour suite
  */
 function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
 {
     global $conf, $mysoc;
     $sign = 1;
     if ($object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) {
         $sign = -1;
     }
     $default_font_size = pdf_getPDFFontSize($outputlangs);
     $tab2_top = $posy;
     $tab2_hl = 4;
     $pdf->SetFont('', '', $default_font_size - 1);
     // Tableau total
     $col1x = 120;
     $col2x = 170;
     if ($this->page_largeur < 210) {
         $col2x -= 20;
     }
     $largcol2 = $this->page_largeur - $this->marge_droite - $col2x;
     $useborder = 0;
     $index = 0;
     // Total HT
     $pdf->SetFillColor(255, 255, 255);
     $pdf->SetXY($col1x, $tab2_top + 0);
     $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
     $total_ht = $conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht;
     $pdf->SetXY($col2x, $tab2_top + 0);
     $pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($total_ht + (!empty($object->remise) ? $object->remise : 0)), 0, $outputlangs), 0, 'R', 1);
     // Show VAT by rates and total
     $pdf->SetFillColor(248, 248, 248);
     $this->atleastoneratenotnull = 0;
     if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
         $tvaisnull = !empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000']) ? true : false;
         if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull) {
             // Nothing to do
         } else {
             //Local tax 1 before VAT
             //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
             //{
             foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
                 if (in_array((string) $localtax_type, array('1', '3', '5'))) {
                     continue;
                 }
                 foreach ($localtax_rate as $tvakey => $tvaval) {
                     if ($tvakey != 0) {
                         //$this->atleastoneratenotnull++;
                         $index++;
                         $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
                         $tvacompl = '';
                         if (preg_match('/\\*/', $tvakey)) {
                             $tvakey = str_replace('*', '', $tvakey);
                             $tvacompl = " (" . $outputlangs->transnoentities("NonPercuRecuperable") . ")";
                         }
                         $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code) . ' ';
                         $totalvat .= vatrate(abs($tvakey), 1) . $tvacompl;
                         $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
                         $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
                         $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
                     }
                 }
             }
             //}
             //Local tax 2 before VAT
             //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
             //{
             foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
                 if (in_array((string) $localtax_type, array('1', '3', '5'))) {
                     continue;
                 }
                 foreach ($localtax_rate as $tvakey => $tvaval) {
                     if ($tvakey != 0) {
                         //$this->atleastoneratenotnull++;
                         $index++;
                         $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
                         $tvacompl = '';
                         if (preg_match('/\\*/', $tvakey)) {
                             $tvakey = str_replace('*', '', $tvakey);
                             $tvacompl = " (" . $outputlangs->transnoentities("NonPercuRecuperable") . ")";
                         }
                         $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code) . ' ';
                         $totalvat .= vatrate(abs($tvakey), 1) . $tvacompl;
                         $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
                         $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
                         $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
                     }
                 }
             }
             //}
             // VAT
             foreach ($this->tva as $tvakey => $tvaval) {
                 if ($tvakey > 0) {
                     $this->atleastoneratenotnull++;
                     $index++;
                     $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
                     $tvacompl = '';
                     if (preg_match('/\\*/', $tvakey)) {
                         $tvakey = str_replace('*', '', $tvakey);
                         $tvacompl = " (" . $outputlangs->transnoentities("NonPercuRecuperable") . ")";
                     }
                     $totalvat = $outputlangs->transnoentities("TotalVAT") . ' ';
                     $totalvat .= vatrate($tvakey, 1) . $tvacompl;
                     $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
                     $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
                     $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
                 }
             }
             //Local tax 1 after VAT
             //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
             //{
             foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
                 if (in_array((string) $localtax_type, array('2', '4', '6'))) {
                     continue;
                 }
                 foreach ($localtax_rate as $tvakey => $tvaval) {
                     if ($tvakey != 0) {
                         //$this->atleastoneratenotnull++;
                         $index++;
                         $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
                         $tvacompl = '';
                         if (preg_match('/\\*/', $tvakey)) {
                             $tvakey = str_replace('*', '', $tvakey);
                             $tvacompl = " (" . $outputlangs->transnoentities("NonPercuRecuperable") . ")";
                         }
                         $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code) . ' ';
                         $totalvat .= vatrate(abs($tvakey), 1) . $tvacompl;
                         $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
                         $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
                         $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
                     }
                 }
             }
             //}
             //Local tax 2 after VAT
             //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
             //{
             foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
                 if (in_array((string) $localtax_type, array('2', '4', '6'))) {
                     continue;
                 }
                 foreach ($localtax_rate as $tvakey => $tvaval) {
                     // retrieve global local tax
                     if ($tvakey != 0) {
                         //$this->atleastoneratenotnull++;
                         $index++;
                         $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
                         $tvacompl = '';
                         if (preg_match('/\\*/', $tvakey)) {
                             $tvakey = str_replace('*', '', $tvakey);
                             $tvacompl = " (" . $outputlangs->transnoentities("NonPercuRecuperable") . ")";
                         }
                         $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code) . ' ';
                         $totalvat .= vatrate(abs($tvakey), 1) . $tvacompl;
                         $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
                         $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
                         $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
                     }
                 }
                 //}
             }
             // Revenue stamp
             if (price2num($object->revenuestamp) != 0) {
                 $index++;
                 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
                 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RevenueStamp"), $useborder, 'L', 1);
                 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
                 $pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->revenuestamp), $useborder, 'R', 1);
             }
             // Total TTC
             $index++;
             $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
             $pdf->SetTextColor(0, 0, 60);
             $pdf->SetFillColor(224, 224, 224);
             $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
             $total_ttc = $conf->multicurrency->enabled && $object->multiccurency_tx != 1 ? $object->multicurrency_total_ttc : $object->total_ttc;
             $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
             $pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1);
         }
     }
     $pdf->SetTextColor(0, 0, 0);
     $creditnoteamount = $object->getSumCreditNotesUsed();
     $depositsamount = $object->getSumDepositsUsed();
     //print "x".$creditnoteamount."-".$depositsamount;exit;
     $resteapayer = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
     if ($object->paye) {
         $resteapayer = 0;
     }
     if ($deja_regle > 0 || $creditnoteamount > 0 || $depositsamount > 0) {
         // Already paid + Deposits
         $index++;
         $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
         $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("Paid"), 0, 'L', 0);
         $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
         $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle + $depositsamount, 0, $outputlangs), 0, 'R', 0);
         // Credit note
         if ($creditnoteamount) {
             $index++;
             $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
             $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("CreditNotes"), 0, 'L', 0);
             $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
             $pdf->MultiCell($largcol2, $tab2_hl, price($creditnoteamount, 0, $outputlangs), 0, 'R', 0);
         }
         // Escompte
         if ($object->close_code == Facture::CLOSECODE_DISCOUNTVAT) {
             $index++;
             $pdf->SetFillColor(255, 255, 255);
             $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
             $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOfferedShort"), $useborder, 'L', 1);
             $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
             $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 0, $outputlangs), $useborder, 'R', 1);
             $resteapayer = 0;
         }
         $index++;
         $pdf->SetTextColor(0, 0, 60);
         $pdf->SetFillColor(224, 224, 224);
         $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
         $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1);
         $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
         $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1);
         $pdf->SetFont('', '', $default_font_size - 1);
         $pdf->SetTextColor(0, 0, 0);
     }
     $index++;
     return $tab2_top + $tab2_hl * $index;
 }
Ejemplo n.º 29
0
    print_liste_field_titre($langs->trans("WithdrawalsReceipts"), "bons.php", "p.ref", '', '', 'class="liste_titre"');
    print_liste_field_titre($langs->trans("Date"), "bons.php", "p.datec", "", "", 'class="liste_titre" align="center"');
    print '<td class="liste_titre" align="right">' . $langs->trans("Amount") . '</td>';
    print '</tr>';
    print '<tr class="liste_titre">';
    print '<form action="bons.php" method="GET">';
    print '<td class="liste_titre"><input type="text" class="flat" name="search_ligne" value="' . $search_line . '" size="10"></td>';
    print '<td class="liste_titre">&nbsp;</td>';
    print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '"></td>';
    print '</form>';
    print '</tr>';
    $var = True;
    while ($i < min($num, $conf->liste_limit)) {
        $obj = $db->fetch_object($result);
        $var = !$var;
        print "<tr " . $bc[$var] . "><td>";
        print $bon->LibStatut($obj->statut, 2);
        print "&nbsp;";
        print '<a href="fiche.php?id=' . $obj->rowid . '">' . $obj->ref . "</a></td>\n";
        print '<td align="center">' . dol_print_date($db->jdate($obj->datec), 'day') . "</td>\n";
        print '<td align="right">' . price($obj->amount) . "</td>\n";
        print "</tr>\n";
        $i++;
    }
    print "</table>";
    $db->free($result);
} else {
    dol_print_error($db);
}
$db->close();
llxFooter();
Ejemplo n.º 30
0
        if (!empty($conf->propal->enabled) && $key > 0) {
            print '&nbsp;<a href="' . DOL_URL_ROOT . '/comm/propal/stats/index.php?socid=' . $key . '">' . img_picto($langs->trans("ProposalStats"), "stats") . '</a>&nbsp;';
        }
        if (!empty($conf->commande->enabled) && $key > 0) {
            print '&nbsp;<a href="' . DOL_URL_ROOT . '/commande/stats/index.php?socid=' . $key . '">' . img_picto($langs->trans("OrderStats"), "stats") . '</a>&nbsp;';
        }
        if (!empty($conf->facture->enabled) && $key > 0) {
            print '&nbsp;<a href="' . DOL_URL_ROOT . '/compta/facture/stats/index.php?socid=' . $key . '">' . img_picto($langs->trans("InvoiceStats"), "stats") . '</a>&nbsp;';
        }
        print '</td>';
        print "</tr>\n";
        $i++;
    }
    // Total
    print '<tr class="liste_total">';
    print '<td>' . $langs->trans("Total") . '</td>';
    if ($modecompta != 'CREANCES-DETTES') {
        print '<td colspan="1"></td>';
    } else {
        print '<td align="right">' . price($catotal_ht) . '</td>';
    }
    print '<td align="right">' . price($catotal) . '</td>';
    print '<td>&nbsp;</td>';
    print '<td>&nbsp;</td>';
    print '</tr>';
    $db->free($result);
}
print "</table>";
print '</form>';
llxFooter();
$db->close();