Exemplo n.º 1
0
 public function setZarfiat($zarfiat, $customer_id = -1)
 {
     if ($customer_id == -1 && isset($_SESSION[conf::app . "_customer_id"])) {
         $customer_id = (int) $_SESSION[conf::app . "_customer_id"];
     }
     if ($customer_id > 0) {
         $customer = new customer_class($customer_id);
         $customer_zarfiat = $this->getZarfiat($customer_id);
         $free_zarfiat = $this->getZarfiat();
         $requested_zarfiat = $zarfiat;
         $customer_zakhire = $customer_zarfiat - $free_zarfiat;
         $total_zarfiat = $this->zarfiat;
         $this->zarfiat -= $requested_zarfiat;
         if ($free_zarfiat < $requested_zarfiat) {
             $customer_zakhire -= $requested_zarfiat - $free_zarfiat;
         }
         mysql_class::ex_sqlx("update `parvaz_det` set `zarfiat` = '" . $this->zarfiat . "'  where `id` = '" . $this->id . "'");
         if ((int) $customer_zakhire != 0) {
             $customer->setZakhire($this->id, $customer_zakhire);
         }
         /*
         				if($p_zarfiat >= $zarfiat)
         				{
         					if($zarfiat > $this->getZarfiat())
         					{
         						
         					}
         					$this->zarfiat -= $zarfiat;
         					$zakhire = $zakhire - ($zarfiat - $this->zarfiat);
         					mysql_class::ex_sqlx("update `parvaz_det` set `zarfiat` = '".$this->zarfiat."'  where `id` = '".$this->id."'");
         					$customer->setZakhire($this->id,$zakhire);
         				}
         */
     }
 }
Exemplo n.º 2
0
 public function setZarfiat($zarfiat, $customer_id = -1)
 {
     $conf = new conf();
     $mysql = new mysql_class();
     if ($customer_id == -1 && isset($_SESSION[$conf->app . "_customer_id"])) {
         $customer_id = (int) $_SESSION[$conf->app . "_customer_id"];
     }
     if ($customer_id > 0) {
         $customer = new customer_class($customer_id);
         $customer_zarfiat = $this->getZarfiat($customer_id);
         $free_zarfiat = $this->getZarfiat();
         $requested_zarfiat = $zarfiat;
         $customer_zakhire = $customer_zarfiat - $free_zarfiat;
         $total_zarfiat = $this->zarfiat;
         $this->zarfiat -= $requested_zarfiat;
         $customer_zakhire -= $requested_zarfiat;
         if ($customer_zakhire < 0) {
             $customer_zakhire = 0;
         }
         $customer->setZakhire($this->id, $customer_zakhire);
         $mysql->ex_sqlx("update `parvaz_det` set `zarfiat` = '" . $this->zarfiat . "'  where `id` = '" . $this->id . "'");
         /*
         				if($free_zarfiat < $requested_zarfiat)
         				{
         					$customer_zakhire -= ($requested_zarfiat-$free_zarfiat);
         				}
         				$mysql->ex_sqlx("update `parvaz_det` set `zarfiat` = '".$this->zarfiat."'  where `id` = '".$this->id."'");
         				if((int)$customer_zakhire!=0)
         					$customer->setZakhire($this->id,$customer_zakhire);
         */
     }
 }