Exemplo n.º 1
0
 public function __construct($calc_id)
 {
     $this->calc_id = $calc_id;
     //подключения к базе
     $this->con = sasql_connect("UID=dba;PWD=gjknfdf_rhtlbns;SERVER=app_12;DBN=lease12;HOST=front");
     //информацыя о машине
     $q = 'select * from calc_pars where calc_id = ' . $this->calc_id;
     $res = sasql_query($this->con, $q);
     $this->car = sasql_fetch_array($res);
     //        $this->prn($this->car);
     $q = 'SELECT * FROM "DBA"."s_mark" where id = ' . $this->car['mark_id'];
     $res = sasql_query($this->con, $q);
     $this->mark = sasql_fetch_array($res);
     $this->model = $this->car['mark_id'];
     $q = 'select month_id, debt*-1 as debt from Graphics_Calc where calc_id = ' . $this->calc_id;
     //        $this->prn($q);
     $res = sasql_query($this->con, $q);
     //        $this->ulf_pay = sasql_fetch_array($res);
     while ($row = sasql_fetch_array($res)) {
         $this->ulf_pay[$row['month_id']] = $row['debt'];
     }
     //        $this->prn($this->ulf_pay);
 }
Exemplo n.º 2
0
 private function skoring14()
 {
     $q = 'SELECT Summa = sum(isnull(charge_auto,0))+sum(isnull(charge_kasko,0))+
           sum(isnull(charge_osago,0))+sum(isnull(charge_beg,0))+sum(isnull(Summa_srv,0))-sum(isnull(base_srv,0))
           +(select fpay from calc_pars where calc_id= ' . $this->calc_id . ')
           FROM graphics_calc
           where calc_id=' . $this->calc_id . ' and month_id between 0 and 12';
     $res = sasql_query($this->con, $q);
     $summ = sasql_fetch_array($res);
     $summ = $summ['Summa'] * -1;
     //        $CY = $summ-$this->car['fpay'];
     $CY = $summ;
     //        echo($CY);
     $q = "CALL calc_get_kurs_php()";
     $res = sasql_query($this->con, $q);
     $res1 = sasql_fetch_array($res);
     $kyrs = $res1['kyrs'];
     //        var_dump($CY/$kyrs);
     if ($CY / $kyrs <= 50000) {
         if ($this->hesDogovor) {
             $this->save('14', 1, 'Су = ' . round($CY / $kyrs, 2) . '.$ Необходимо дополнительно учесть сумму инвестиций по действуюшему договору.');
         } else {
             $this->save('14', 0);
         }
     } elseif ($CY / $kyrs > 50000) {
         if ($this->hesDogovor) {
             $this->save('14', 1, 'Су превышает эквивалент 50 тыс.долларов на  ' . (int) ($CY / $kyrs - 50000) . ' долларов США. Необходимо дополнительно учесть сумму инвестицый по действуюшему договору.');
         } else {
             $this->save('14', 1, 'Су превышает эквивалент 50 тыс.долларов на  ' . (int) ($CY / $kyrs - 50000) . ' долларов США.');
         }
     }
 }
 /**
  * {@inheritdoc}
  *
  * @throws SQLAnywhereException
  */
 public function fetch($fetchMode = null)
 {
     if (!is_resource($this->result) || get_resource_type($this->result) !== 'SQLAnywhere result') {
         return false;
     }
     $fetchMode = $fetchMode ?: $this->defaultFetchMode;
     switch ($fetchMode) {
         case PDO::FETCH_ASSOC:
             return sasql_fetch_assoc($this->result);
         case PDO::FETCH_BOTH:
             return sasql_fetch_array($this->result, SASQL_BOTH);
         case PDO::FETCH_CLASS:
             $className = $this->defaultFetchClass;
             $ctorArgs = $this->defaultFetchClassCtorArgs;
             if (func_num_args() >= 2) {
                 $args = func_get_args();
                 $className = $args[1];
                 $ctorArgs = isset($args[2]) ? $args[2] : array();
             }
             $result = sasql_fetch_object($this->result);
             if ($result instanceof \stdClass) {
                 $result = $this->castObject($result, $className, $ctorArgs);
             }
             return $result;
         case PDO::FETCH_NUM:
             return sasql_fetch_row($this->result);
         case PDO::FETCH_OBJ:
             return sasql_fetch_object($this->result);
         default:
             throw new SQLAnywhereException('Fetch mode is not supported: ' . $fetchMode);
     }
 }
 /**
  * Return All values of Results in one choose format
  * @param  constant $type Format of return
  * @return array       
  */
 public function fetchAll($type = SQLAnywhereClient::FETCH_ASSOC)
 {
     $data = array();
     if ($this->result) {
         switch ($type) {
             case 'array':
                 while ($row = sasql_fetch_array($this->result)) {
                     array_push($data, $row);
                 }
                 break;
             case 'assoc':
                 while ($row = sasql_fetch_assoc($this->result)) {
                     array_push($data, $row);
                 }
                 break;
             case 'row':
                 while ($row = sasql_fetch_row($this->result)) {
                     array_push($data, $row);
                 }
                 break;
             case 'field':
                 while ($row = sasql_fetch_field($this->result)) {
                     array_push($data, $row);
                 }
                 break;
             case 'object':
                 while ($row = sasql_fetch_object($this->result)) {
                     array_push($data, $row);
                 }
                 break;
             default:
                 while ($row = sasql_fetch_array($this->result)) {
                     array_push($data, $row);
                 }
                 break;
         }
     }
     return $data;
 }
Exemplo n.º 5
-1
 public function __construct($calc_id)
 {
     $this->calc_id = $calc_id;
     //подключения к базе
     $this->con = sasql_connect("UID=dba;PWD=gjknfdf_rhtlbns;SERVER=app_12;DBN=lease12;HOST=front");
     $q1 = 'SELECT * FROM "DBA"."физ_лица_nst" LEFT  JOIN Applications on Applications.app_client_id="физ_лица_nst".ID
             LEFT JOIN app_calc on Applications.app_id=app_calc.app_id where app_calc.calc_id=' . $this->calc_id;
     $res = sasql_query($this->con, $q1);
     $this->users = sasql_fetch_array($res);
     $this->inn = $this->users['ИНН'];
     //        $this->inn = '2905602379';
     $this->lnameua = $this->users['Фамилия'];
     //        $this->lnameua = 'Нікітін';
     $this->fnameua = $this->users['Имя'];
     //        $this->fnameua = 'Андрій';
     $this->mnameua = $this->users['Отчество'];
     //        $this->mnameua = 'Іванович';
     $this->pser = $this->users['Паспорт_Серия'];
     //        $this->pser = 'КН';
     $this->pnom = $this->users['Паспорт_Номер'];
     //        $this->pnom = '925600';
     $this->bdate = $this->users['Дата_Рождения'];
     //        $this->bdate = '1969-06-17';
     //        $this->prn($this->users);
 }