Beispiel #1
0
function ieraksts_skatits_zagbalki($skatits_id)
{
    $tmpSQL_txt = "SELECT * FROM `zagbalki` WHERE `id` = {$skatits_id}";
    $tmpSQL = mysql_query($tmpSQL_txt);
    while ($tmpSQL_arr = mysql_fetch_assoc($tmpSQL)) {
        $tmp_kontrolmernieks = $tmpSQL_arr['kontrolmernieks'];
        $tmp_datums_sakums = dateFormatChange($tmpSQL_arr['started']);
        $tmp_pasutitajs = changeReciever($tmpSQL_arr['pasutitajs'], $tmpSQL_arr['viet_kods']);
        $tmp_piegadatajs = $tmpSQL_arr['piegadatajs'];
        $tmp_uzm_vieta = $tmpSQL_arr['viet_kods'];
        $tmp_pasut_nr = $tmpSQL_arr['pasnr'];
        $tmpSQL_data_txt = "SELECT * FROM `zagbalki_merijumi` WHERE `zagbalki_id` = {$skatits_id}";
        $tmpSQL_data = mysql_query($tmpSQL_data_txt);
        while ($tmpSQL_data_arr = mysql_fetch_assoc($tmpSQL_data)) {
            $rowIsTrue = true;
            $tmp_mernieks = $tmpSQL_data_arr['pg'];
            $tmp_balka_nr = $tmpSQL_data_arr['nr'];
            $tmp_suga = $tmpSQL_data_arr['sg'];
            $tmp_skira = $tmpSQL_data_arr['sk'];
            $tmp_miza = $tmpSQL_data_arr['mt'];
            $tmp_diam_tievgalis = $tmpSQL_data_arr['tc'];
            $tmp_diam_vidus = $tmpSQL_data_arr['vc'];
            $tmp_diam_resgalis = $tmpSQL_data_arr['rcc'];
            $tmp_garums = $tmpSQL_data_arr['gr'];
            $tmp_redukcija_diam = $tmpSQL_data_arr['rg'];
            $tmp_redukcija_gar = $tmpSQL_data_arr['rc'];
            $tmp_brakis = $tmpSQL_data_arr['im'];
            $tmp_kb_numurs = $tmpSQL_data_arr['kb'];
            $tmp_ts = dateFormatChange($tmpSQL_data_arr['ts']);
            $tmp_te = dateFormatChange($tmpSQL_data_arr['te']);
            if ($tmpSQL_arr['pasutitajs'] == '42') {
                $tmp_diam_resgalis = 0;
            }
            if ($tmpSQL_arr['pasutitajs'] == '25') {
                $tmp_diam_resgalis = 0;
            }
            if ($tmp_brakis === 'NULL') {
                $tmp_brakis = "";
            }
            if ($tmp_kb_numurs === 'NULL') {
                $tmp_kb_numurs = "";
            }
            if ($tmp_diam_vidus < 1 && $tmp_diam_tievgalis < 1 && $tmp_diam_resgalis < 1 && $tmp_mernieks < 1) {
                $rowIsTrue = false;
            }
            $tmpSQL_insert_txt = "INSERT INTO `kontrol_zagbalki` (`datums_sakums`, `kontrolmernieks`, `mernieks`, `pasutitajs`, `piegadatajs`, \n                            `uzm_vieta`, `pasut_nr`, `balka_nr`, `suga`, `skira`, `miza`, `diam_tievgalis`, `diam_vidus`, `diam_resgalis`, \n                            `garums`, `redukcija_diam`, `redukcija_gar`, `brakis`, `kb_numurs`,`ts`,`te`) \n                            VALUES ('{$tmp_datums_sakums}','{$tmp_kontrolmernieks}','{$tmp_mernieks}','{$tmp_pasutitajs}','{$tmp_piegadatajs}','{$tmp_uzm_vieta}',\n                            '{$tmp_pasut_nr}','{$tmp_balka_nr}','{$tmp_suga}','{$tmp_skira}','{$tmp_miza}','{$tmp_diam_tievgalis}','{$tmp_diam_vidus}','{$tmp_diam_resgalis}',\n                            '{$tmp_garums}','{$tmp_redukcija_diam}','{$tmp_redukcija_gar}','{$tmp_brakis}','{$tmp_kb_numurs}','{$tmp_ts}','{$tmp_te}')";
            //echo $tmpSQL_insert_txt;
            if ($rowIsTrue) {
                if (!mysql_query($tmpSQL_insert_txt)) {
                    $tmp_SendMySQLError = 'Kļūda DB izpildē: [#7000001][' . mysql_errno() . '] 
            ' . mysql_error() . '
            DB Query: ' . $tmpSQL_insert_txt;
                    snd_GlobalMailErr($tmp_SendMySQLError);
                    return false;
                }
            }
        }
    }
    $result = mysql_query("UPDATE `zagbalki` SET skatits=1 WHERE id=" . $skatits_id . "") or die(mysql_error());
    return true;
}
     $_POST['head']['auto_head'] = $mpav['auto'];
 }
 if ($mpav['soferis']) {
     $_POST['head']['soferis_head'] = $mpav['soferis'];
 }
 if ($mpav['transport_firm']) {
     $_POST['head']['transport_firm'] = $mpav['transport_firm'];
 }
 if (trim($mpav['fsc']) != '') {
     $_POST['head']['fsc'] = $mpav['fsc'];
 }
 if ($mpav['kad_uzmer']) {
     $_POST['head']['kad_uzmer'] = dateFormatChange(substr($mpav['kad_uzmer'], 0, 10));
 }
 if ($mpav['kad_piegad']) {
     $_POST['head']['kad_piegad'] = dateFormatChange(substr($mpav['kad_piegad'], 0, 10));
 }
 if ($mpav['transp_darba_uzd']) {
     $_POST['head']['transp_darba_uzd'] = $mpav['transp_darba_uzd'];
 }
 if ($mpav['cirsmas_kods']) {
     $_POST['head']['cirsma_head'] = $mpav['cirsmas_kods'];
 }
 if ($mpav['iecirknis_pieg']) {
     $_POST['head']['iecirknis_head'] = $mpav['iecirknis_pieg'];
 }
 if ($_POST['vieta_head']) {
     $_POST['head']['vieta_head'] = $_POST['vieta_head'];
 }
 if ($_POST['custom12_head']) {
     $_POST['head']['custom12_head'] = $_POST['custom12_head'];