Esempio n. 1
0
 public function getTotal()
 {
     $products = BuyProductData::getAllByBuyId($this->id);
     $total = 0;
     foreach ($products as $px) {
         $p = ProductData::getById($px->product_id);
         $total += $p->price * $px->q;
     }
     return $total;
 }
Esempio n. 2
0
<?php 
$buy = BuyData::getById($_GET["buy_id"]);
$products = BuyProductData::getAllByBuyId($_GET["buy_id"]);
?>
<div class="row">
	<div class="col-md-12">
	<h2> Compra #<?php 
echo $buy->id;
?>
 [<?php 
echo $buy->getStatus()->name;
?>
]</h2>
<?php 
if (count($products) > 0) {
    ?>
<table class="table table-bordered">
	<thead>
		<th></th>
		<th>Codigo</th>
		<th>Total</th>
		<th>Estado</th>
	</thead>
	<?php 
    foreach ($products as $p) {
        $px = $p->getProduct();
        ?>
	<tr>
		<td><a href="index.php?view=producto&product_id=<?php 
        echo $px->id;
Esempio n. 3
0
    $alphabeth = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYZ1234567890_-";
    $code = "";
    $k = "";
    for ($i = 0; $i < 11; $i++) {
        $code .= $alphabeth[rand(0, strlen($alphabeth) - 1)];
        $k .= $alphabeth[rand(0, strlen($alphabeth) - 1)];
    }
    $buy->k = $k;
    $buy->code = $code;
    $buy->coupon_id = isset($_SESSION["coupon"]) ? $_SESSION["coupon"] : "NULL";
    $buy->client_id = $_SESSION["client_id"];
    $buy->paymethod_id = $_POST["paymethod_id"];
    $buy->status_id = 1;
    $b = $buy->add();
    foreach ($_SESSION["cart"] as $c) {
        $p = new BuyProductData();
        $p->buy_id = $b[1];
        $p->product_id = $c["product_id"];
        $p->q = $c["q"];
        $p->add();
    }
    /////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////// Emailing
    $client = ClientData::getById($_SESSION["client_id"]);
    $adminemail = $paypal_business = ConfigurationData::getByPreffix("general_main_email")->val;
    $replymessage = '
<meta content="es-mx" http-equiv="Content-Language" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<body>
<h2>Tienda en Linea</h2>
<h3>Compra Pendiente</h3>
Esempio n. 4
0
 function ImprovedTable($data)
 {
     $iva = ConfigurationData::getByPreffix("general_iva")->val;
     $iva_txt = ConfigurationData::getByPreffix("general_iva_txt")->val;
     $coin = ConfigurationData::getByPreffix("general_coin")->val;
     $service = BuyData::getByCode($_GET["code"]);
     $products = BuyProductData::getAllByBuyId($service->id);
     $client = ClientData::getById($service->client_id);
     $this->setY(31);
     $this->setX(20);
     $this->setY(31);
     $this->setX(20);
     $this->SetFont('Arial', 'B', 8);
     $this->setY(33);
     $this->setX(20);
     $this->setY(40);
     $this->setX(20);
     $this->SetFont('Arial', 'B', 8);
     //         $this->Cell(0,35,"",1);
     $this->setY(38);
     $this->setX(20);
     $this->Cell(0, 10, " NOMBRE:        " . $client->getFullname());
     $this->setY(43);
     $this->setX(20);
     $this->Cell(0, 10, " DIRECCION:        " . $client->address);
     $this->setY(48);
     $this->setX(20);
     $this->Cell(0, 10, "TEL:      " . $client->phone);
     $this->setY(53);
     $this->setX(20);
     $this->setY(80);
     $this->setX(20);
     $this->SetFont('Arial', '', 14);
     $this->Cell(0, 10, " DETALLES DE LA COMPRA ");
     $this->SetFont('Arial', 'B', 10);
     $starty = 0;
     $total = 0;
     //    $inventary_item = InventaryData::getAllBySII($service->id,$ii->id);
     $this->setY(95 + $starty);
     $this->setX(20);
     //// omito el super trabajo
     ///         $this->Cell(0,10,strtoupper($w->getWork()->name));
     $this->setY(95 + $starty);
     $this->setX(65);
     //         $starty+=5;
     //////////////////////// materiales
     if (count($products)) {
         $starty += 5;
         foreach ($products as $itemx) {
             $item = $itemx->getProduct();
             $mtx = null;
             $this->setY(95 + $starty);
             $this->setX(20);
             $this->Cell(0, 10, strtoupper($itemx->q));
             $this->setX(30);
             $this->Cell(0, 10, strtoupper($item->getUnit()->name));
             $this->setX(50);
             $this->Cell(0, 10, strtoupper($item->name));
             $this->setX(180);
             $this->Cell(0, 10, utf8_decode($coin) . " " . number_format($item->price, 2, ".", ","));
             $total += $itemx->q * $item->price;
             $this->setY(95 + $starty);
             $this->setX(65);
             $starty += 5;
         }
     }
     $starty += 5;
     ///////////////////////////////////////////////////////////// Total
     $this->SetFont('Arial', '', 12);
     $this->setY(125 + $starty);
     $this->setX(20);
     $this->Cell(0, 10, "SubTotal:          " . utf8_decode($coin) . " " . number_format($total * (1 - $iva / 100), 2, ".", ","));
     $starty += 5;
     $this->setY(125 + $starty);
     $this->setX(20);
     $this->Cell(0, 10, "{$iva_txt}:                   " . utf8_decode($coin) . " " . number_format($total * ($iva / 100), 2, ".", ","));
     $starty += 5;
     $this->setY(125 + $starty);
     $this->setX(20);
     $this->Cell(0, 10, "Total:                 " . utf8_decode($coin) . " " . number_format($total, 2, ".", ","));
     /////////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////
 }
Esempio n. 5
0
 function ImprovedTable($data)
 {
     $service = BuyData::getByCode($_GET["code"]);
     $products = BuyProductData::getAllByBuyId($service->id);
     $client = ClientData::getById($service->client_id);
     $this->setY(31);
     $this->setX(20);
     $this->setY(31);
     $this->setX(20);
     $this->SetFont('Arial', 'B', 8);
     $this->setY(33);
     $this->setX(20);
     $this->setY(40);
     $this->setX(20);
     $this->SetFont('Arial', 'B', 8);
     //         $this->Cell(0,35,"",1);
     $this->setY(38);
     $this->setX(20);
     $this->Cell(0, 10, " NOMBRE:        " . $client->name);
     $this->setY(43);
     $this->setX(20);
     $this->Cell(0, 10, " DIRECCION:        " . $client->address);
     $this->setY(48);
     $this->setX(20);
     $this->Cell(0, 10, "TEL:      " . $client->phone);
     $this->setY(53);
     $this->setX(20);
     $this->setY(80);
     $this->setX(20);
     $this->SetFont('Arial', '', 14);
     $this->Cell(0, 10, " DETALLES DE LA COMPRA ");
     $this->SetFont('Arial', 'B', 10);
     $starty = 0;
     $total = 0;
     //    $inventary_item = InventaryData::getAllBySII($service->id,$ii->id);
     $this->setY(95 + $starty);
     $this->setX(20);
     //// omito el super trabajo
     ///         $this->Cell(0,10,strtoupper($w->getWork()->name));
     $this->setY(95 + $starty);
     $this->setX(65);
     //         $starty+=5;
     //////////////////////// materiales
     if (count($products)) {
         $starty += 5;
         foreach ($products as $itemx) {
             $item = $itemx->getProduct();
             $mtx = null;
             $this->setY(95 + $starty);
             $this->setX(20);
             $this->Cell(0, 10, strtoupper($itemx->q));
             $this->setX(30);
             $this->Cell(0, 10, strtoupper($item->getUnit()->name));
             $this->setX(50);
             $this->Cell(0, 10, strtoupper($item->name));
             $this->setX(180);
             $this->Cell(0, 10, "\$ " . number_format($item->price, 2, ".", ","));
             $total += $itemx->q * $item->price;
             $this->setY(95 + $starty);
             $this->setX(65);
             $starty += 5;
         }
     }
     ////////////////////////
     //////////////////////// materiales
     /*if(count($subworks)){
              $this->setX(20);
              $this->Cell(0,(count($subworks)*5)+10,"",1);
              $this->setY(95+$starty);
              $this->setX(20);
              $this->Cell(0,10,strtoupper("**MATERIALES"));
              $starty+=5;
         foreach($subworks as $item){
             $mtx=null;
             foreach($mts as $mt){ if($mt->material_id==$item->id){ $mtx = $mt; }}
             if($mtx!=null&& $mtx->material_id==$item->id){
                 
              $this->setY(95+$starty);
              $this->setX(20);
              $this->Cell(0,10,strtoupper($item->name));
              $this->setX(180);
              $this->Cell(0,10,"$ ".number_format($item->price,2,".",","));
              $this->setY(95+$starty);
              $this->setX(65);
              $starty+=5;
     
             }
     
         }
     }
     */
     ////////////////////////
     //         $this->Cell(0,10,"|X|__| ");
     //         $this->Cell(0,10,"|__|X| ");
     $starty += 5;
     ///////////////////////////////////////////////////////////// Total
     $this->SetFont('Arial', '', 12);
     $this->setY(125 + $starty);
     $this->setX(20);
     $this->Cell(0, 10, "SubTotal:          \$ " . number_format($total * 0.84, 2, ".", ","));
     $starty += 5;
     $this->setY(125 + $starty);
     $this->setX(20);
     $this->Cell(0, 10, "IVA:                   \$ " . number_format($total * 0.16, 2, ".", ","));
     $starty += 5;
     $this->setY(125 + $starty);
     $this->setX(20);
     $this->Cell(0, 10, "Total:                 \$ " . number_format($total, 2, ".", ","));
     /////////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////
 }
Esempio n. 6
0
    ?>
<div class="box box-primary">
<div id="graph" class="animate" data-animate="fadeInUp" ></div>
</div>
<script>

<?php 
    echo "var c=0;";
    echo "var dates=Array();";
    echo "var data=Array();";
    echo "var total=Array();";
    for ($i = $start_at; $i <= $finish_at; $i += 60 * 60 * 24) {
        $operations = BuyData::getAllByDate(date("Y-m-d", $i));
        $total = 0;
        foreach ($operations as $buy) {
            $opxs = BuyProductData::getAllByBuyId($buy->id);
            foreach ($opxs as $op) {
                $product = $op->getProduct();
                $total += $op->q * $product->price;
            }
        }
        //  echo $operations[0]->t;
        //  $sl = $operations[0]->t!=null?$operations[0]->t:0;
        // $sp = $spends[0]->t!=null?$spends[0]->t:0;
        echo "dates[c]=\"" . date("Y-m-d", $i) . "\";";
        echo "data[c]=" . $total . ";";
        echo "total[c]={x: dates[c],y: data[c]};";
        echo "c++;";
    }
    ?>
// Use Morris.Area instead of Morris.Line