function print_level($level, $query, &$summa_p, $irbrakis_p, $suga, $id) { global $lang; global $translate; // tekošā grupēšanas līmeņa lauks $lauks = $this->MyPOST["gtype" . $this->grup . $level]; ////////////////////////////////////////////////////////////////// JA IR DAL?JUMS PA SUG?M ////////////////// if ($lauks == 'garums' || $lauks == 'mind_pirms_red' || $lauks == 'skira') { if ($this->MyPOST["dalit" . $this->grup . $level] && $suga) { // ja ir sadalījums pa sugām ņemam attiecīgo lauku $gvalues = "gvalues" . $this->grup . $level . "_" . $suga; } else { // ja nav tad ņemam kopīgo $gvalues = "gvalues" . $this->grup . $level; } // sadalam nepieciešamās vērtības //echo $this->MyPOST[$gvalues]; $a = explode(',', $this->MyPOST[$gvalues]); $a = str_replace(' ', '', $a); // brāķis $abr = array(); for ($i = 0; $i < count($a); $i++) { if (substr($a[$i], 0, 1) == 'b' || substr($a[$i], 0, 1) == 'B') { $abr[$i] = '1'; //kursh masiva elements apzime braki $a[$i] = substr($a[$i], 1); //masiva elements bez B prieksa } } } ////////////////////////////////////////////////////////////////// JA IR DAL?JUMS PA SUG?M ////////////////// if ($lauks == 'fsc') { $a = array(); $a[0] = '0'; $a[1] = '1'; $typ = 'string'; } if ($lauks == 'kad_piegad' || $lauks == 'auto' || $lauks == 'brakis' || $lauks == 'cenu_matrica' || $lauks == 'cirsmas_kods' || $lauks == 'kad_piegad' || $lauks == 'kravas_id' || $lauks == 'pavadzime.pavadzime' || $lauks == 'piegad_kods' || $lauks == 'soferis' || $lauks == 'suga' || $lauks == 'iecirknis' || $lauks == 'skira' && $a[0] == '' && sizeof($abr) == 0) { //no visiem atlas?tajiem ba??iem pavadz?m? atlasa attiec?g? lauka atrodam?s v?rt?bas (pa vienai) $a = array(); $query__ = "select DISTINCT {$lauks} as lauks " . $query . " order by {$lauks} "; $r = $this->DB->query($query__); $ii = 0; while ($m = $this->DB->get_row($r)) { $a[$ii] = $m['lauks']; $ii++; } if ($lauks == 'brakis') { if ($a[count($a) - 1] == '255') { for ($j = count($a) - 1; $j > 0; $j--) { $a[$j] = $a[$j - 1]; } $a[0] = '255'; } } $typ = 'string'; } $row = 0; $summa_p->init(); $myid = 0; while (list($key, $val) = each($a)) { $myid++; if ($lauks == 'suga') { $suga = $val; } // virsm?ru sadal?jums if ($suga && $this->MyPOST['dalit_virsmeri' . $this->grup]) { if ($this->MyPOST['virsmeri' . $this->grup . '_' . $suga] != '') { $virsmeri = explode(',', $this->MyPOST['virsmeri' . $this->grup . '_' . $suga]); for ($i = 0; $i < count($virsmeri); $i++) { $virsmeri[$i] = $virsmeri[$i] / 100; } } } else { if ($this->MyPOST['virsmeri' . $this->grup] != '') { $virsmeri = explode(',', $this->MyPOST['virsmeri' . $this->grup]); for ($i = 0; $i < count($virsmeri); $i++) { $virsmeri[$i] = $virsmeri[$i] / 100; } } } if ($suga && $this->MyPOST['dalit_raukums' . $this->grup]) { $raukums = raukums_2_array($this->MyPOST['raukums' . $this->grup . '_' . $suga]); } else { $raukums = raukums_2_array($this->MyPOST['raukums' . $this->grup]); } if ($suga && $this->MyPOST['dalit_koeficients' . $this->grup]) { $koeficients = $this->MyPOST['koeficients' . $this->grup . '_' . $suga]; } else { $koeficients = $this->MyPOST['koeficients' . $this->grup]; } if ($typ != 'string') { $mbounds = explode('-', $a[$row]); } if (count($mbounds) > 1) { $low_range_brakis = 0; $high_range_brakis = 0; if ($mbounds[0] > 5) { $low_range_brakis = $mbounds[0]; } else { $low_range_brakis = $mbounds[0]; } if ($mbounds[1] < 994) { $high_range_brakis = $mbounds[1]; } else { $high_range_brakis = $mbounds[1]; } //pievienots 17.07.2007 if ($this->MyPOST["gtype" . $this->grup . $level] == 'mind_pirms_red') { $myquery = $query . " and ((" . $this->MyPOST["gtype" . $this->grup . $level] . ">=" . $mbounds[0] . " and " . $this->MyPOST["gtype" . $this->grup . $level] . "<=" . $mbounds[1] . " AND balkis_temp.import_type <> 'zbm') or (" . $this->MyPOST["gtype" . $this->grup . $level] . ">=" . $low_range_brakis . " and " . $this->MyPOST["gtype" . $this->grup . $level] . "<=" . $high_range_brakis . " AND balkis_temp.import_type = 'zbm'))"; } else { $myquery = $query . " and (" . $this->MyPOST["gtype" . $this->grup . $level] . ">=" . $mbounds[0] . " and " . $this->MyPOST["gtype" . $this->grup . $level] . "<=" . $mbounds[1] . ")"; } //echo 'adding to query = ' . $query . " and (". $this->MyPOST["gtype".$this->grup.$level] . ">=" . $mbounds[0] ." and " . $this->MyPOST["gtype".$this->grup.$level] . "<=" . $mbounds[1] . ")" . '<br />'; //echo '$myquery = ' . $myquery . '<br />'; //$myquery = $query . " and (". $this->MyPOST["gtype".$this->grup.$level] . ">=" . $mbounds[0] ." and " . $this->MyPOST["gtype".$this->grup.$level] . "<=" . $mbounds[1] . ")"; } else { if ($typ == 'string') { $myquery = $query . " and " . $this->MyPOST["gtype" . $this->grup . $level] . "='" . $a[$row] . "'"; } else { $myquery = $query . " and " . $this->MyPOST["gtype" . $this->grup . $level] . "=" . $a[$row]; } } $row = $row + 1; if ($this->rowclosed == true) { $this->rowclosed = false; $this->arr_index++; $this->arr[$this->arr_index] = array(); } if ($level == 1) { $this->arr[$this->arr_index][0] = ""; } else { if ($row > 1) { for ($i = 1; $i < $level + 1; $i++) { $this->arr[$this->arr_index][$i - 1] = ""; } } } $irbrakis = false; if ($irbrakis_p == true) { $irbrakis = true; } // Ja ir v?l dzi??ki l?me?i if ($level < $this->lsk) { if (!$val || $val == '') { $this->arr[$this->arr_index][$level - 1] = "nav"; } else { $this->arr[$this->arr_index][$level - 1] = $this->kodi($this->MyPOST['gtype' . $this->grup . $level], $val); } $sum = new CSumma(); if (strlen($abr[$key]) == 1) { $irbrakis = true; $brkods = $abr[$key]; } //$rrow = mysql_query("select * from gatskaite where rowid = '".dig3($id).dig3($myid)."'"); //if ($mrow = mysql_fetch_array($rrow)) //{ // $saved = 1; // $x = unserialize($mrow['data']); // $sum = $x[summa]; //} //else //{ //} $this->print_level($level + 1, $myquery, $sum, $irbrakis, $suga, $id . $myid); /* Testa nolūkiem */ // Te saskaita kop? par l?meni summu - XML varianta tas nav jadara if (!$this->XML_Variants) { $this->arr_index++; $this->arr[$this->arr_index] = array(); if ($sum->bruto) { $this->arr[$this->arr_index][-1] = $translate['kopa'][$lang]; for ($i = 0; $i < $this->lsk; $i++) { if ($level == $i + 1) { $this->arr[$this->arr_index][$i] = $this->kodi($this->MyPOST['gtype' . $this->grup . $level], $val); } else { $this->arr[$this->arr_index][$i] = ""; } } if (!$this->MyPOST['negrupet']) { $this->arr[$this->arr_index][summa] = $sum; } //echo "<tr><td height=1 colspan=".(7+$this->lsk)."><hr></tr>"; } } $this->rowclosed = true; if (!$this->MyPOST['negrupet']) { $summa_p->add_skaits($sum->skaits); $summa_p->add_skaits_bad($sum->skaits_bad); $summa_p->add_virsmers($sum->virsmers); $summa_p->add_redukcija_d($sum->redukcija_d); $summa_p->add_redukcija_l($sum->redukcija_l); $summa_p->add_brakis($sum->brakis); $summa_p->add_neto($sum->neto); $summa_p->add_bruto($sum->bruto); //print_r($summa_p); $this->lasttype = 'sum'; } //$this->arr[$this->arr_index]['type']='sum'; //$this->arr[$this->arr_index]['level']=$level; //$st = serialize($this->arr[$this->arr_index]); //if ($level==1) // mysql_query("insert into gatskaite (rowid,data) values ('".dig3($myid)."','$st')"); //else // mysql_query("insert into gatskaite (rowid,data) values ('".dig3($id).dig3($myid)."','$st')"); } else { $this->lasttype = 'data'; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Saakums//////////////////////////////////////////////////////////////////////////////////// if ($this->MyPOST['metode'] == '1') { /*Query izvilksana*/ $query__ = "select balkis_temp.id as Ident, mind_pirms_red as DBruto, garums as LBruto, mind_pec_red as DPecReduc, gar_pec_red as LPecReduc, brakis, pavadzime.cenu_matrica as cm " . $myquery; // echo $query__.'<br /><br />'; $r = $this->DB->query($query__); /*NULL vertibu ievietosana*/ $SVBruto = 0; $SVReducD = 0; $SVReducL = 0; $SVVirsm = 0; $SVNeto = 0; $SVBrakis = 0; $SSkaits = 0; $SSkaitsBad = 0; $gostu_tabula = $this->MyPOST['gostu_tabula' . $this->grup]; /* */ while ($m = $this->DB->get_row($r)) { $SSkaits++; /*Vai ir Vika Wood*/ if ($suga && $this->MyPOST['dalit_virsmers' . $this->grup]) { $min_virsmers = $this->MyPOST['virsmers' . $this->grup . '_' . $suga] / 100; } else { $min_virsmers = $this->MyPOST['virsmers' . $this->grup] / 100; } $Ident = $m['Ident']; // $LBruto = $m['LBruto'] / 100; $DBruto = $m['DBruto'] / 1000; /*Noapalosana Test*/ if ($this->MyPOST['noapalot_garumu'] == '1') { $LBruto = floor($m['LBruto'] / 10) / 10; // echo "Bruto noapaļots = ".$DBrutoNoap.'<br>'; } elseif ($this->MyPOST['noapalot_garumu'] == '2') { $LBruto = (floor($m['LBruto'] / 10) + 0.5) / 10; // echo "Bruto noapaļots = ".$DBrutoNoap.'<br>'; } elseif ($this->MyPOST['noapalot_garumu'] == '3') { $LBruto = $m['LBruto'] / 100; // echo "Bruto noapaļots = ".$DBrutoNoap.'<br>'; } else { $LBruto = $m['LBruto'] / 100; } $rauk_koef = get_raukums_no_diam($raukums, $DBruto * 1000); $DPecReduc = $m['DPecReduc'] / 1000; $DReduc = $DBruto - $DPecReduc; $VBruto = f2($DBruto, $LBruto, $rauk_koef, $koeficients, $gostu_tabula); /* echo "DBruto = ".$DBruto.'<br/>'; echo "LBruto= ".$LBruto.'<br/>'; echo "rauk_koef= ".$rauk_koef.'<br/>'; echo "koeficients = ".$koeficients.'<br/>'; echo "gostu_tabula = ".$gostu_tabula.'<br/>','<br/>','<br/>'; */ //echo $rauk_koef . '; ' . $koeficients . '; ' . $VBruto . '<br />'; $VBezReducD = f2($DPecReduc, $LBruto, $rauk_koef, $koeficients, $gostu_tabula); // $VReducD = $VBruto-$VBezReducD; // echo "VReducD => ".$VReducD." = ".$VBruto." - ".$VBezReducD.'<br/>','<br/>','<br/>'; /*Noapalosana*/ if ($this->MyPOST['noapalot_diametru'] == 'on') { $DBrutoNoap = (floor($m['DBruto'] / 10) + 0.5) / 100; } else { $DBrutoNoap = $m['DBruto'] / 1000; } if ($m[brakis] != '255') { $irbrakis = true; $brkods = 'standart'; } //print_r($this->MyPOST); //echo '<<<<<<<<<<<<<<<<<<<<' . $this->MyPOST['piegad_grupa']; // if (strtoupper($this->MyPOST['pieg_lig_num'])=='VIKA WOOD') { if ($this->MyPOST['is_vika'] == 'on') { $LNeto = $m['LPecReduc'] / 100; $LNom = nom($LBruto, $virsmeri, $min_virsmers); $LPecVirsm = $LNom; $LReduc = round($LPecVirsm - $LNeto, 3); $LVirsm = round($LBruto - $LPecVirsm, 3); $VBezVirsm = f2($DPecReduc, $LBruto - $LVirsm, $rauk_koef, $koeficients, $gostu_tabula); $VBezVirsmNeredD = f2($DBruto, $LBruto - $LVirsm, $rauk_koef, $koeficients, $gostu_tabula); if (!$irbrakis) { $VVirsm = $VBezReducD - $VBezVirsm; } else { $VVirsm = $VBruto - $VBezVirsmNeredD; // $VVirsm = $VBezReducD-$VBezVirsm; } $VBezReducL = f2($DPecReduc, $LPecVirsm - $LReduc, $rauk_koef, $koeficients, $gostu_tabula); $VReducL = $VBezVirsm - $VBezReducL; } else { if ($this->MyPOST['noapalot_garumu'] == '1') { $LPecReduc = floor($m['LPecReduc'] / 10) / 10; $LNeap = $m['LPecReduc'] / 100; } else { $LPecReduc = $m['LPecReduc'] / 100; } $LNom = nom($LNeap, $virsmeri, $min_virsmers); $LNeto = $LNom; $LVirsm = round($LPecReduc - $LNeto, 3); $LReduc = round($LBruto - $LPecReduc, 3); $VBruto_redukcija = f2($DBruto, $LNom, $rauk_koef, $koeficients, $gostu_tabula); //echo $rauk_koef . '; ' . $koeficients . '; ' . $VBruto . '<br />'; $VBezReducD_redukcija = f2($DPecReduc, $LNom, $rauk_koef, $koeficients, $gostu_tabula); $VReducD = $VBruto_redukcija - $VBezReducD_redukcija; $VBezReducL = f2($DBrutoNoap, $LBruto - $LReduc, $rauk_koef, $koeficients, $gostu_tabula); $VReducL = $VBruto - $VBezReducL; $VBezReduc = f2($DPecReduc, $LPecReduc, $rauk_koef, $koeficients, $gostu_tabula); $VBezVirsm = f2($DPecReduc, $LPecReduc - $LVirsm, $rauk_koef, $koeficients, $gostu_tabula); $VBezVirsmNeredD = f2($DBruto, $LPecReduc - $LVirsm, $rauk_koef, $koeficients, $gostu_tabula); if (!$irbrakis) { $VVirsm = $VBruto - $VBezVirsmNeredD; } else { $VVirsm = $VBruto - $VBezVirsmNeredD; } /* if($Ident == 12774972) { // $VBruto = f2($DBruto,$LBruto,$rauk_koef,$koeficients,$gostu_tabula); $Neto = $VBruto - $VReducL - $VReducD - $VVirsm; echo "Bruto tilp.= ".$VBruto.'<br />'."Diametrs = ".$DBruto.'<br />'."Neto = ".$Neto.'<br />'."Diametrs (Tīrais) = ".$m['DBruto'].'<br />'."Garums = ".$LBruto.'<br />'."Garums (Tīrais) = ".$m['LBruto'].'<br />'."Raukums = ".$rauk_koef.'<br />'."Koeficents = ".$koeficients.'<br />'; } */ } $SVBruto += $VBruto; /* Parveidosana uz mazakam mervienibam $DBruto = $DBruto/1000; $DPecReduc = $DPecReduc/1000; $LBruto = $LBruto/100; $LPecReduc = $LPecReduc/100; */ /* $DReduc = round($DBruto - $DPecReduc,3); */ /* echo '<br />','$ID = ' . $r_id . '<br />'; echo '$LPecReduc = ' . $LPecReduc . '<br />'; echo '$LBruto = ' . $LBruto . '<br />'; echo '$DBruto = ' . $DBruto . '<br />'; echo '$DPecReduc = ' . $DPecReduc . '<br />'; echo '$DReduc = ' . $DReduc . '<br />'; echo '$LNeto = ' . $LNeto . '<br />'; echo '$LVirsm = ' . $LVirsm . '<br />'; echo '$LPecVirsm = ' . $LPecVirsm . '<br />'; echo '$LNom = ' . $LNom . '<br />'; echo '$LReduc = ' . $LReduc . '<br />'; echo '$VBruto = ' . $VBruto . '<br />'; echo '$SVBruto = ' . $SVBruto . '<br />'; echo '$SVNeto = ' . $SVNeto . '<br />'; echo '$VReducD = ' . $VReducD . '<br />'; echo '$VBezReducL = ' . $VBezReducL . '<br />'; echo '$VBezReducD = ' . $VBezReducD . '<br />'; echo '$VBezVirsm = ' . $VBezVirsm . '<br />'; echo '$VReducL = ' . $VReducL . '<br />'; echo '$SVReducD = ' . $SVReducD . '<br />'; echo '$SVReducL = ' . $SVReducL . '<br />'; echo '$VBezReduc = ' . $VBezReduc . '<br />'; echo '$VVirsm = ' . $VVirsm . '<br />'; echo '$min_virsmers = ' . $min_virsmers . '<br />'; echo '<br /><br /><br />'; */ /* $bruto_temp = f2($DBruto,$LBruto,$rauk_koef,$koeficients,$gostu_tabula); $bruto_temp_red = f2($DNoapReduc,$LBruto,$rauk_koef,$koeficients,$gostu_tabula); $DReduc = f2($DPecReduc,$LBruto,$rauk_koef,$koeficients,$gostu_tabula); $LReduc = f2($DNoapReduc,$LPecReduc,$rauk_koef,$koeficients,$gostu_tabula); $Reduc = f2($DPecReduc,$LPecReduc,$rauk_koef,$koeficients,$gostu_tabula); $virsm = f2($DPecReduc,$l3,$rauk_koef,$koeficients,$gostu_tabula); $virsm_nered = f2($DBruto,$l3,$rauk_koef,$koeficients,$gostu_tabula); */ /* */ if ($gostu_tabula) { if ($VBruto == -1 || $VReducD == -1 || $VReducL == -1 || $VVirsm == -1) { $SSkaitsBad++; } if ($VBruto == -1) { $VBruto = 0; } if ($VReducD == -1) { $VReducD = 0; } if ($VReducL == -1) { $VReducL = 0; } if ($VVirsm == -1) { $VVirsm = 0; } } // echo '$irbrakis = ' . $irbrakis . '<br />'; /*Vai nav brakis?*/ /* if (!$irbrakis) { $DRed_temp = round($LBruto-$DRed,3); $LRed_temp = round($DBruto-$LRed,3); $VDRed = round($VDRed + $DRed_temp,3); $VLRed = round($VLRed + $LRed_temp,3); } */ $VBrakis = 0; if (strlen($abr[$key]) == 1) { $irbrakis = true; $brkods = $abr[$key]; } // echo '$irbrakis2 = ' . $irbrakis . '<br />'; // echo "VReducD = ".$VReducD.'<br/>'; if (!$irbrakis) { /*Vai ir brakis?*/ if ($LNom != 0) { $SVVirsm += $VVirsm; //$SVNeto += f2($DPecReduc,$LNeto,$rauk_koef,$koeficients,$gostu_tabula); $SVNeto += $VBruto - $VReducL - $VReducD - $VVirsm; $SVReducD += $VReducD; $SVReducL += $VReducL; } else { $SVBrakis += $VBruto; } } else { if ($LNom != 0) { if ($this->MyPOST['braka_virsmers'] == 'on') { $SVVirsm += $VVirsm; $VBrakis = $VBruto - $VVirsm; } else { $VBrakis = $VBruto; } $SVBrakis += $VBrakis; } else { $VBrakis = $VBruto; $SVBrakis += $VBrakis; } } } //-------------------------------------------TEST-Line-> } elseif ($this->MyPOST['metode'] == '2') { $query__ = "select mind_pirms_red as DBruto, garums as LBruto, mind_pec_red as DPecReduc, gar_pec_red as LPecReduc, brakis, pavadzime.cenu_matrica as cm, balkis_temp.id as r_id" . $myquery; $r = $this->DB->query($query__); /*NULL vertibu ievietosana*/ $SVBruto = 0; $SVReducD = 0; $SVReducL = 0; $SVVirsm = 0; $SVNeto = 0; $SVBrakis = 0; $SSkaits = 0; $SSkaitsBad = 0; $gostu_tabula = $this->MyPOST['gostu_tabula' . $this->grup]; /* */ while ($m = $this->DB->get_row($r)) { $SSkaits++; /*Vai ir Vika Wood*/ if ($suga && $this->MyPOST['dalit_virsmers' . $this->grup]) { $min_virsmers = $this->MyPOST['virsmers' . $this->grup . '_' . $suga] / 100; } else { $min_virsmers = $this->MyPOST['virsmers' . $this->grup] / 100; } $r_id = $m['r_id']; // $LBruto = $m['LBruto'] / 100; $DBruto = $m['DBruto'] / 1000; /*Noapalosana Test*/ if ($this->MyPOST['noapalot_garumu'] == '1') { $LBruto = floor($m['LBruto'] / 10) / 10; // echo "Bruto noapaļots = ".$DBrutoNoap.'<br>'; } elseif ($this->MyPOST['noapalot_garumu'] == '2') { $LBruto = (floor($m['LBruto'] / 10) + 0.5) / 10; // echo "Bruto noapaļots = ".$DBrutoNoap.'<br>'; } elseif ($this->MyPOST['noapalot_garumu'] == '3') { $LBruto = $m['LBruto'] / 100; // echo "Bruto noapaļots = ".$DBrutoNoap.'<br>'; } else { $LBruto = $m['LBruto'] / 100; } $rauk_koef = get_raukums_no_diam($raukums, $DBruto * 1000); $DPecReduc = $m['DPecReduc'] / 1000; $DReduc = $DBruto - $DPecReduc; $VBruto = f2_mod($DBruto, $LBruto, $rauk_koef, $koeficients, $gostu_tabula); /* echo "DBruto = ".$DBruto.'<br/>'; echo "LBruto= ".$LBruto.'<br/>'; echo "rauk_koef= ".$rauk_koef.'<br/>'; echo "koeficients = ".$koeficients.'<br/>'; echo "gostu_tabula = ".$gostu_tabula.'<br/>','<br/>','<br/>'; */ //echo $rauk_koef . '; ' . $koeficients . '; ' . $VBruto . '<br />'; $VBezReducD = f2_mod($DPecReduc, $LBruto, $rauk_koef, $koeficients, $gostu_tabula); // $VReducD = $VBruto-$VBezReducD; // echo "VReducD => ".$VReducD." = ".$VBruto." - ".$VBezReducD.'<br/>','<br/>','<br/>'; /*Noapalosana*/ if ($this->MyPOST['noapalot_diametru'] == 'on') { $DBrutoNoap = (floor($m['DBruto'] / 10) + 0.5) / 100; } else { $DBrutoNoap = $m['DBruto'] / 1000; } if ($m[brakis] != '255') { $irbrakis = true; $brkods = 'standart'; } //print_r($this->MyPOST); //echo '<<<<<<<<<<<<<<<<<<<<' . $this->MyPOST['piegad_grupa']; // if (strtoupper($this->MyPOST['pieg_lig_num'])=='VIKA WOOD') { if ($this->MyPOST['is_vika'] == 'on') { $LNeto = $m['LPecReduc'] / 100; $LNom = nom($LBruto, $virsmeri, $min_virsmers); $LPecVirsm = $LNom; $LReduc = round($LPecVirsm - $LNeto, 3); $LVirsm = round($LBruto - $LPecVirsm, 3); $VBezVirsm = f2_mod($DPecReduc, $LBruto - $LVirsm, $rauk_koef, $koeficients, $gostu_tabula); $VBezVirsmNeredD = f2_mod($DBruto, $LBruto - $LVirsm, $rauk_koef, $koeficients, $gostu_tabula); if (!$irbrakis) { $VVirsm = $VBezReducD - $VBezVirsm; } else { $VVirsm = $VBruto - $VBezVirsmNeredD; // $VVirsm = $VBezReducD-$VBezVirsm; } $VBezReducL = f2_mod($DPecReduc, $LPecVirsm - $LReduc, $rauk_koef, $koeficients, $gostu_tabula); $VReducL = $VBezVirsm - $VBezReducL; } else { if ($this->MyPOST['noapalot_garumu'] == '1') { $LPecReduc = floor($m['LPecReduc'] / 10) / 10; $LNeap = $m['LPecReduc'] / 100; } else { $LPecReduc = $m['LPecReduc'] / 100; } $LNom = nom($LNeap, $virsmeri, $min_virsmers); $LNeto = $LNom; $LVirsm = round($LPecReduc - $LNeto, 3); $LReduc = round($LBruto - $LPecReduc, 3); $VBruto_redukcija = f2_mod($DBruto, $LNom, $rauk_koef, $koeficients, $gostu_tabula); //echo $rauk_koef . '; ' . $koeficients . '; ' . $VBruto . '<br />'; $VBezReducD_redukcija = f2_mod($DPecReduc, $LNom, $rauk_koef, $koeficients, $gostu_tabula); $VReducD = $VBruto_redukcija - $VBezReducD_redukcija; $VBezReducL = f2_mod($DBrutoNoap, $LBruto - $LReduc, $rauk_koef, $koeficients, $gostu_tabula); $VReducL = $VBruto - $VBezReducL; $VBezReduc = f2_mod($DPecReduc, $LPecReduc, $rauk_koef, $koeficients, $gostu_tabula); $VBezVirsm = f2_mod($DPecReduc, $LPecReduc - $LVirsm, $rauk_koef, $koeficients, $gostu_tabula); $VBezVirsmNeredD = f2_mod($DBruto, $LPecReduc - $LVirsm, $rauk_koef, $koeficients, $gostu_tabula); if (!$irbrakis) { $VVirsm = $VBruto - $VBezVirsmNeredD; } else { $VVirsm = $VBruto - $VBezVirsmNeredD; } } $SVBruto += $VBruto; /* */ /* Parveidosana uz mazakam mervienibam $DBruto = $DBruto/1000; $DPecReduc = $DPecReduc/1000; $LBruto = $LBruto/100; $LPecReduc = $LPecReduc/100; */ /* $DReduc = round($DBruto - $DPecReduc,3); */ /* echo '<br />','$ID = ' . $r_id . '<br />'; echo '$LPecReduc = ' . $LPecReduc . '<br />'; echo '$LBruto = ' . $LBruto . '<br />'; echo '$DBruto = ' . $DBruto . '<br />'; echo '$DPecReduc = ' . $DPecReduc . '<br />'; echo '$DReduc = ' . $DReduc . '<br />'; echo '$LNeto = ' . $LNeto . '<br />'; echo '$LVirsm = ' . $LVirsm . '<br />'; echo '$LPecVirsm = ' . $LPecVirsm . '<br />'; echo '$LNom = ' . $LNom . '<br />'; echo '$LReduc = ' . $LReduc . '<br />'; echo '$VBruto = ' . $VBruto . '<br />'; echo '$SVBruto = ' . $SVBruto . '<br />'; echo '$SVNeto = ' . $SVNeto . '<br />'; echo '$VReducD = ' . $VReducD . '<br />'; echo '$VBezReducL = ' . $VBezReducL . '<br />'; echo '$VBezReducD = ' . $VBezReducD . '<br />'; echo '$VBezVirsm = ' . $VBezVirsm . '<br />'; echo '$VReducL = ' . $VReducL . '<br />'; echo '$SVReducD = ' . $SVReducD . '<br />'; echo '$SVReducL = ' . $SVReducL . '<br />'; echo '$VBezReduc = ' . $VBezReduc . '<br />'; echo '$VVirsm = ' . $VVirsm . '<br />'; echo '$min_virsmers = ' . $min_virsmers . '<br />'; echo '<br /><br /><br />'; /* /* $bruto_temp = f2($DBruto,$LBruto,$rauk_koef,$koeficients,$gostu_tabula); $bruto_temp_red = f2($DNoapReduc,$LBruto,$rauk_koef,$koeficients,$gostu_tabula); $DReduc = f2($DPecReduc,$LBruto,$rauk_koef,$koeficients,$gostu_tabula); $LReduc = f2($DNoapReduc,$LPecReduc,$rauk_koef,$koeficients,$gostu_tabula); $Reduc = f2($DPecReduc,$LPecReduc,$rauk_koef,$koeficients,$gostu_tabula); $virsm = f2($DPecReduc,$l3,$rauk_koef,$koeficients,$gostu_tabula); $virsm_nered = f2($DBruto,$l3,$rauk_koef,$koeficients,$gostu_tabula); */ /* */ if ($gostu_tabula) { if ($VBruto == -1 || $VReducD == -1 || $VReducL == -1 || $VVirsm == -1) { $SSkaitsBad++; } if ($VBruto == -1) { $VBruto = 0; } if ($VReducD == -1) { $VReducD = 0; } if ($VReducL == -1) { $VReducL = 0; } if ($VVirsm == -1) { $VVirsm = 0; } } // echo '$irbrakis = ' . $irbrakis . '<br />'; /*Vai nav brakis?*/ /* if (!$irbrakis) { $DRed_temp = round($LBruto-$DRed,3); $LRed_temp = round($DBruto-$LRed,3); $VDRed = round($VDRed + $DRed_temp,3); $VLRed = round($VLRed + $LRed_temp,3); } */ $VBrakis = 0; if (strlen($abr[$key]) == 1) { $irbrakis = true; $brkods = $abr[$key]; } // echo '$irbrakis2 = ' . $irbrakis . '<br />'; // echo "VReducD = ".$VReducD.'<br/>'; if (!$irbrakis) { /*Vai ir brakis?*/ if ($LNom != 0) { $SVVirsm += $VVirsm; //$SVNeto += f2($DPecReduc,$LNeto,$rauk_koef,$koeficients,$gostu_tabula); $SVNeto += $VBruto - $VReducL - $VReducD - $VVirsm; $SVReducD += $VReducD; $SVReducL += $VReducL; } else { $SVBrakis += $VBruto; } } else { if ($LNom != 0) { if ($this->MyPOST['braka_virsmers'] == 'on') { $SVVirsm += $VVirsm; $VBrakis = $VBruto - $VVirsm; } else { $VBrakis = $VBruto; } $SVBrakis += $VBrakis; } else { $VBrakis = $VBruto; $SVBrakis += $VBrakis; } } } //-------------------------------------------TEST-Line-> } elseif ($this->MyPOST['metode'] == '3') { /*3.metode<------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*Query izvilksana*/ $query__ = "select mind_pirms_red as tievgalis_pirms_redukcijas,maxd_miza as resgalis_pirms_redukcijas, garums as LBruto,balkis_temp.id as bb_id,mind_pirms_red as DPirmsReduc, mind_pec_red as DPecReduc, gar_pec_red as LPecReduc, brakis, pavadzime.cenu_matrica as cm" . $myquery; $r = $this->DB->query($query__); $SVBruto = 0; $SVReducD = 0; $SVReducL = 0; $SVVirsm = 0; $SVNeto = 0; $SVBrakis = 0; $SSkaits = 0; $SSkaitsBad = 0; $gostu_tabula = $this->MyPOST['gostu_tabula' . $this->grup]; while ($m = $this->DB->get_row($r)) { /* Testēšanas nolūkiem */ if ($this->MyPOST['negrupet']) { $SVBruto = 0; $SVReducD = 0; $SVReducL = 0; $SVVirsm = 0; $SVNeto = 0; $SVBrakis = 0; $SSkaits = 0; $SSkaitsBad = 0; } $SSkaits++; /*Vai ir Vika Wood*/ $idents = $m['bb_id']; if ($suga && $this->MyPOST['dalit_virsmers' . $this->grup]) { $min_virsmers = $this->MyPOST['virsmers' . $this->grup . '_' . $suga] / 100; } else { $min_virsmers = $this->MyPOST['virsmers' . $this->grup] / 100; } $r_id = $m['r_id']; $DBruto = $m['tievgalis_pirms_redukcijas'] / 1000; $Diametra_starpiba = $m['DPirmsReduc'] - $m['DPecReduc']; $balkis_id = $m['balkis_id']; /*Noapalosana Test*/ if ($this->MyPOST['noapalot_garumu'] == '1') { $LBruto = floor($m['LBruto'] / 10) / 10; } elseif ($this->MyPOST['noapalot_garumu'] == '2') { $LBruto = (floor($m['LBruto'] / 10) + 0.5) / 10; } elseif ($this->MyPOST['noapalot_garumu'] == '3') { $LBruto = $m['LBruto'] / 100; } else { $LBruto = $m['LBruto'] / 100; } $rauk_koef = get_raukums_no_diam($raukums, $DBruto * 1000); $DPecReduc = $m['DPecReduc'] / 1000; $DPecReducResg = ($m['resgalis_pirms_redukcijas'] - $Diametra_starpiba) / 1000; $DReduc = $DBruto - $DPecReduc; if ($this->MyPOST['noapalot_diametru'] == 'on') { $DBrutoNoap = (floor($m['tievgalis_pirms_redukcijas'] / 10) + 0.5) / 100; $DBrutoResg = (floor($m['resgalis_pirms_redukcijas'] / 10) + 0.5) / 100; } else { $DBrutoNoap = $m['tievgalis_pirms_redukcijas'] / 1000; $DBrutoResg = $m['resgalis_pirms_redukcijas'] / 1000; } if ($m[brakis] != '255') { $irbrakis = true; $brkods = 'standart'; } /* echo "Tievgalis = ".$DBrutoNoap.'<br />'; echo "Tievgalis pec redukcijas = ".$DPecReduc.'<br />'; echo "Resgalis = ".$DBrutoResg.'<br />'; echo "Resgalis pec redukcijas = ".$DPecReducResg.'<br />'.'<br />'; */ if ($this->MyPOST['is_vika'] == 'on') { if ($this->MyPOST['noapalot_garumu'] == '1') { $LPecReduc = floor($m['LPecReduc'] / 10) / 10; } else { $LPecReduc = $m['LPecReduc'] / 100; } $LNomBruto = nom_3($m['LBruto'], $virsmeri, $min_virsmers) / 100; $LnomNeto = $m['LPecReduc'] / 100; $tilpums_bruto = f2_mod_3($DBrutoNoap, $DBrutoResg, $LBruto, $rauk_koef, $koeficients, $gostu_tabula); $tilpums_neto = f2_mod_3($DPecReduc, $DPecReducResg, $LnomNeto, $rauk_koef, $koeficients, $gostu_tabula); $tilpums_bruto_virsmeram = f2_mod_3($DBrutoNoap, $DBrutoResg, $LNomBruto, $rauk_koef, $koeficients, $gostu_tabula); $tilpums_garuma_redukcijai = f2_mod_3($DBrutoNoap, $DBrutoResg, $LnomNeto, $rauk_koef, $koeficients, $gostu_tabula); $tilpums_diametra_redukcijai_neto = f2_mod_3($DPecReduc, $DPecReducResg, $LnomNeto, $rauk_koef, $koeficients, $gostu_tabula); $tilpums_virsmers = $tilpums_bruto - $tilpums_bruto_virsmeram; $tilpums_kopejai_redukcijai = $tilpums_bruto_virsmeram - $tilpums_diametra_redukcijai_neto; $tilpums_garuma_redukcija = $tilpums_kopejai_redukcijai; $tilpums_diametrs_redukcija = 0; } else { if ($this->MyPOST['noapalot_garumu'] == '1') { $LPecReduc = floor($m['LPecReduc'] / 10) / 10; } else { $LPecReduc = $m['LPecReduc'] / 100; } $LNomBruto = nom_3($m['LBruto'], $virsmeri, $min_virsmers) / 100; $LnomNeto = nom_3($m['LPecReduc'], $virsmeri, $min_virsmers) / 100; $tilpums_bruto = f2_mod_3($DBrutoNoap, $DBrutoResg, $LBruto, $rauk_koef, $koeficients, $gostu_tabula); $tilpums_neto = f2_mod_3($DPecReduc, $DPecReducResg, $LnomNeto, $rauk_koef, $koeficients, $gostu_tabula); $tilpums_bruto_virsmeram = f2_mod_3($DBrutoNoap, $DBrutoResg, $LNomBruto, $rauk_koef, $koeficients, $gostu_tabula); $tilpums_garuma_redukcijai = f2_mod_3($DBrutoNoap, $DBrutoResg, $LnomNeto, $rauk_koef, $koeficients, $gostu_tabula); $tilpums_virsmers = $tilpums_bruto - $tilpums_bruto_virsmeram; $tilpums_kopejai_redukcijai = $tilpums_bruto_virsmeram - $tilpums_neto; $tilpums_garuma_redukcija = $tilpums_kopejai_redukcijai; $tilpums_diametrs_redukcija = 0; } $SVBruto += $tilpums_bruto; if ($gostu_tabula) { if ($VBruto == -1 || $VReducD == -1 || $VReducL == -1 || $VVirsm == -1) { $SSkaitsBad++; // echo "Skaits = ".$SSkaitsBad.'<br />'; } if ($VBruto == -1) { $VBruto = 0; } if ($VReducD == -1) { $VReducD = 0; } if ($VReducL == -1) { $VReducL = 0; } if ($VVirsm == -1) { $VVirsm = 0; } } $VBrakis = 0; if (strlen($abr[$key]) == 1) { $irbrakis = true; $brkods = $abr[$key]; } if (!$irbrakis) { if ($LnomNeto != 0) { $SVVirsm += $tilpums_virsmers; $SVNeto += $tilpums_neto; } else { $tilpums_diametrs_redukcija = 0; $tilpums_garuma_redukcija = 0; $VBrakis = $tilpums_bruto; $SVBrakis += $tilpums_bruto; } $SVReducD += $tilpums_diametrs_redukcija; $SVReducL += $tilpums_garuma_redukcija; } else { if ($LnomNeto != 0) { if ($this->MyPOST['braka_virsmers'] == 'on') { $SVVirsm += $tilpums_virsmers; $VBrakis = $tilpums_bruto - $tilpums_virsmers; } else { $VBrakis = $tilpums_bruto; } $SVBrakis += $VBrakis; } else { $VBrakis = $tilpums_bruto; $SVBrakis += $VBrakis; } } /* Testēšanas nolūkiem */ if ($this->MyPOST['negrupet']) { $this->arr[$this->arr_index][$level - 1] = $this->kodi($this->MyPOST['gtype' . $this->grup . $this->lsk], $val); //Pievienoju pārbaudi uz redukcijas negatīvu lielumu 2010-03-09, Ervīns if ($SVReducD + $SVReducL < 0) { $this->ERRORS .= "<font color=red>Pavadzīmē " . $this->MyPOST['pavadzime'] . " izveidojās negatīvs redukcijas lielums!</font><br><br>"; return false; } $this->arr[$this->arr_index][2] = $m['tievgalis_pirms_redukcijas']; $this->arr[$this->arr_index][3] = $m['LBruto']; $sm = new CSumma(); $sm->skaits = $SSkaits; $sm->skaits_bad = $SSkaitsBad; $sm->virsmers = $SVVirsm; $sm->redukcija_d = $SVReducD; $sm->redukcija_l = $SVReducL; $sm->brakis = $SVBrakis; $sm->neto = $SVNeto; $sm->bruto = $SVBruto; $this->arr[$this->arr_index][summa] = $sm; $this->rowclosed = true; $summa_p->add_skaits($SSkaits); $summa_p->add_skaits_bad($SSkaitsBad); $summa_p->add_virsmers($SVVirsm); $summa_p->add_redukcija_d($SVReducD); $summa_p->add_redukcija_l($SVReducL); $summa_p->add_brakis($SVBrakis); $summa_p->add_neto($SVNeto); $summa_p->add_bruto($SVBruto); $this->arr_index++; } } /*------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ } else { /*4.metode<------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*Query izvilksana*/ $query__ = "select mind_pirms_red as DBruto, garums as LBruto, mind_pec_red as DPecReduc, gar_pec_red as LPecReduc, brakis, pavadzime.cenu_matrica as cm" . $myquery; // echo $query__.'<br />'; $r = $this->DB->query($query__); /*NULL vertibu ievietosana*/ $SVBruto = 0; $SVReducD = 0; $SVReducL = 0; $SVVirsm = 0; $SVNeto = 0; $SVBrakis = 0; $SSkaits = 0; $SSkaitsBad = 0; $gostu_tabula = $this->MyPOST['gostu_tabula' . $this->grup]; /**/ while ($m = $this->DB->get_row($r)) { $SSkaits++; /*Vai ir Vika Wood*/ if ($suga && $this->MyPOST['dalit_virsmers' . $this->grup]) { $min_virsmers = $this->MyPOST['virsmers' . $this->grup . '_' . $suga] / 100; } else { $min_virsmers = $this->MyPOST['virsmers' . $this->grup] / 100; } // $LBruto = $m['LBruto'] / 100; $DBruto = $m['DBruto'] / 1000; /*Noapalosana Test*/ if ($this->MyPOST['noapalot_garumu'] == '1') { $LBruto = floor($m['LBruto'] / 10) / 10; // echo "Bruto noapaļots = ".$DBrutoNoap.'<br>'; } elseif ($this->MyPOST['noapalot_garumu'] == '2') { $LBruto = (floor($m['LBruto'] / 10) + 0.5) / 10; // echo "Bruto noapaļots = ".$DBrutoNoap.'<br>'; } elseif ($this->MyPOST['noapalot_garumu'] == '3') { $LBruto = $m['LBruto'] / 100; // echo "Bruto noapaļots = ".$DBrutoNoap.'<br>'; } else { $LBruto = $m['LBruto'] / 100; } $rauk_koef = get_raukums_no_diam($raukums, $DBruto * 1000); $DPecReduc = $m['DPecReduc'] / 1000; $DReduc = $DBruto - $DPecReduc; $VBruto = f2($DBruto, $LBruto, $rauk_koef, $koeficients, $gostu_tabula); // echo $rauk_koef . '; ' . $koeficients . '; ' . $VBruto . '<br />'; $VBezReducD = f2($DPecReduc, $LBruto, $rauk_koef, $koeficients, $gostu_tabula); $VReducD = $VBruto - $VBezReducD; /*Noapalosana*/ if ($this->MyPOST['noapalot_diametru'] == 'on') { $DBrutoNoap = (floor($m['DBruto'] / 10) + 0.5) / 100; } else { $DBrutoNoap = $m['DBruto'] / 1000; } if ($m[brakis] != '255') { $irbrakis = true; $brkods = 'standart'; } //print_r($this->MyPOST); //echo '<<<<<<<<<<<<<<<<<<<<' . $this->MyPOST['piegad_grupa']; // if (strtoupper($this->MyPOST['pieg_lig_num'])=='VIKA WOOD') { if ($this->MyPOST['is_vika'] == 'on') { $LNeto = $m['LPecReduc'] / 100; $LNom = nom($LBruto, $virsmeri, $min_virsmers); $LPecVirsm = $LNom; $LReduc = round($LPecVirsm - $LNeto, 3); $LVirsm = round($LBruto - $LPecVirsm, 3); $VBezVirsm = f2($DPecReduc, $LBruto - $LVirsm, $rauk_koef, $koeficients, $gostu_tabula); $VBezVirsmNeredD = f2($DBruto, $LBruto - $LVirsm, $rauk_koef, $koeficients, $gostu_tabula); if (!$irbrakis) { $VVirsm = $VBezReducD - $VBezVirsm; } else { $VVirsm = $VBezReducD - $VBezVirsm; // $VVirsm = $VBruto-$VBezVirsmNeredD; } // $VVirsm = $VBezReducD-$VBezVirsm; $VBezReducL = f2($DPecReduc, $LPecVirsm - $LReduc, $rauk_koef, $koeficients, $gostu_tabula); $VReducL = $VBezVirsm - $VBezReducL; } else { if ($this->MyPOST['noapalot_garumu'] == '1') { $LPecReduc = floor($m['LPecReduc'] / 10) / 10; } else { $LPecReduc = $m['LPecReduc'] / 100; } $LNom = nom($LPecReduc, $virsmeri, $min_virsmers); $LNeto = $LNom; $LVirsm = round($LPecReduc - $LNeto, 3); $LReduc = round($LBruto - $LPecReduc, 3); $VBezReducL = f2($DBrutoNoap, $LBruto - $LReduc, $rauk_koef, $koeficients, $gostu_tabula); $VReducL = $VBruto - $VBezReducL; $VBezReduc = f2($DPecReduc, $LPecReduc, $rauk_koef, $koeficients, $gostu_tabula); $VBezVirsm = f2($DPecReduc, $LPecReduc - $LVirsm, $rauk_koef, $koeficients, $gostu_tabula); $VBezVirsmNeredD = f2($DBruto, $LPecReduc - $LVirsm, $rauk_koef, $koeficients, $gostu_tabula); if (!$irbrakis) { $VVirsm = $VBezReduc - $VBezVirsm; } else { $VVirsm = $VBezReduc - $VBezVirsm; // $VVirsm = $VBruto-$VBezVirsmNeredD; } } $SVBruto += $VBruto; if ($gostu_tabula) { if ($VBruto == -1 || $VReducD == -1 || $VReducL == -1 || $VVirsm == -1) { $SSkaitsBad++; } if ($VBruto == -1) { $VBruto = 0; } if ($VReducD == -1) { $VReducD = 0; } if ($VReducL == -1) { $VReducL = 0; } if ($VVirsm == -1) { $VVirsm = 0; } } /*Vai nav brakis?*/ /* if (!$irbrakis) { $DRed_temp = round($LBruto-$DRed,3); $LRed_temp = round($DBruto-$LRed,3); $VDRed = round($VDRed + $DRed_temp,3); $VLRed = round($VLRed + $LRed_temp,3); } */ $VBrakis = 0; if (strlen($abr[$key]) == 1) { $irbrakis = true; $brkods = $abr[$key]; } if (!$irbrakis) { /*Vai ir brakis?*/ $SVReducD += $VReducD; $SVReducL += $VReducL; if ($LNom != 0) { $SVVirsm += $VVirsm; //$SVNeto += f2($DPecReduc,$LNeto,$rauk_koef,$koeficients,$gostu_tabula); $SVNeto += $VBruto - $VReducL - $VReducD - $VVirsm; } else { $SVBrakis += $VBezReduc; } } else { if ($LNom != 0) { if ($this->MyPOST['braka_virsmers'] == 'on') { $SVVirsm += $VVirsm; $VBrakis = $VBruto - $VVirsm; } else { $VBrakis = $VBruto; } $SVBrakis += $VBrakis; } else { $VBrakis = $VBruto; $SVBrakis += $VBrakis; } } } /*------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ } // echo '$brakis = ' . $SVBrakis . '<br />'; // echo '<br /><br /><br />'; /*Ievietosana*/ /* Testēšanas nolūkiem */ if (!$this->MyPOST['negrupet']) { $this->arr[$this->arr_index][$level - 1] = $this->kodi($this->MyPOST['gtype' . $this->grup . $this->lsk], $val); $sm = new CSumma(); $sm->skaits = $SSkaits; $sm->skaits_bad = $SSkaitsBad; $sm->virsmers = $SVVirsm; $sm->redukcija_d = $SVReducD; $sm->redukcija_l = $SVReducL; $sm->brakis = $SVBrakis; $sm->neto = $SVNeto; $sm->bruto = $SVBruto; $this->arr[$this->arr_index][summa] = $sm; $this->rowclosed = true; $summa_p->add_skaits($SSkaits); $summa_p->add_skaits_bad($SSkaitsBad); $summa_p->add_virsmers($SVVirsm); $summa_p->add_redukcija_d($SVReducD); $summa_p->add_redukcija_l($SVReducL); $summa_p->add_brakis($SVBrakis); $summa_p->add_neto($SVNeto); $summa_p->add_bruto($SVBruto); } } } /* */ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////Beigas///////////////////////////////////////////// // "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"; // Aizpild?m tuk?umus // "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"; if ($this->lsk > 1) { for ($j = $this->lsk - 2; $j >= 0; $j--) { $v = $this->arr[0][$j]; for ($i = 0; $i < count($this->arr); $i++) { // iekop?jam ja tuk?s if ($this->arr[$i][$j] == "" && $this->arr[$i][$j + 1] != "") { $this->arr[$i][$j] = $v; } // ja nav tuk?s pa?em v?rt?bu if ($this->arr[$i][$j] != "") { $v = $this->arr[$i][$j]; } } } } }
function print_level($level, $query, &$summa_p, $irbrakis_p, $suga, $id) { global $lang; global $translate; // tekošā grupēšanas līmeņa lauks $lauks = $this->MyPOST["gtype" . $this->grup . $level]; ////////////////////////////////////////////////////////////////// JA IR DAL?JUMS PA SUG?M ////////////////// if ($lauks == 'garums' || $lauks == 'mind_pirms_red' || $lauks == 'skira') { if ($this->MyPOST["dalit" . $this->grup . $level] && $suga) { // ja ir sadalījums pa sugām ņemam attiecīgo lauku $gvalues = "gvalues" . $this->grup . $level . "_" . $suga; } else { // ja nav tad ņemam kopīgo $gvalues = "gvalues" . $this->grup . $level; } // sadalam nepieciešamās vērtības //echo $this->MyPOST[$gvalues]; $a = explode(',', $this->MyPOST[$gvalues]); $a = str_replace(' ', '', $a); // brāķis $abr = array(); for ($i = 0; $i < count($a); $i++) { if (substr($a[$i], 0, 1) == 'b' || substr($a[$i], 0, 1) == 'B') { $abr[$i] = '1'; //kursh masiva elements apzime braki $a[$i] = substr($a[$i], 1); //masiva elements bez B prieksa } } } ////////////////////////////////////////////////////////////////// JA IR DAL?JUMS PA SUG?M ////////////////// if ($lauks == 'fsc') { $a = array(); $a[0] = '0'; $a[1] = '1'; $typ = 'string'; } if ($lauks == 'kad_piegad' || $lauks == 'auto' || $lauks == 'brakis' || $lauks == 'cenu_matrica' || $lauks == 'cirsmas_kods' || $lauks == 'kad_piegad' || $lauks == 'kravas_id' || $lauks == 'nelss_pavadzime.pavadzime' || $lauks == 'piegad_kods' || $lauks == 'soferis' || $lauks == 'suga' || $lauks == 'iecirknis' || $lauks == 'skira' && $a[0] == '' && sizeof($abr) == 0) { //no visiem atlas?tajiem ba??iem pavadz?m? atlasa attiec?g? lauka atrodam?s v?rt?bas (pa vienai) $a = array(); $query__ = "select DISTINCT {$lauks} as lauks " . $query . " order by {$lauks} "; $r = $this->DB->query($query__); $ii = 0; while ($m = $this->DB->get_row($r)) { $a[$ii] = $m['lauks']; $ii++; } if ($lauks == 'brakis') { if ($a[count($a) - 1] == '255') { for ($j = count($a) - 1; $j > 0; $j--) { $a[$j] = $a[$j - 1]; } $a[0] = '255'; } } $typ = 'string'; } $row = 0; $summa_p->init(); $myid = 0; while (list($key, $val) = each($a)) { $myid++; if ($lauks == 'suga') { $suga = $val; } // virsm?ru sadal?jums if ($suga && $this->MyPOST['dalit_virsmeri' . $this->grup]) { if ($this->MyPOST['virsmeri' . $this->grup . '_' . $suga] != '') { $virsmeri = explode(',', $this->MyPOST['virsmeri' . $this->grup . '_' . $suga]); for ($i = 0; $i < count($virsmeri); $i++) { $virsmeri[$i] = $virsmeri[$i] / 100; } } } else { if ($this->MyPOST['virsmeri' . $this->grup] != '') { $virsmeri = explode(',', $this->MyPOST['virsmeri' . $this->grup]); for ($i = 0; $i < count($virsmeri); $i++) { $virsmeri[$i] = $virsmeri[$i] / 100; } } } if ($suga && $this->MyPOST['dalit_raukums' . $this->grup]) { $raukums = raukums_2_array($this->MyPOST['raukums' . $this->grup . '_' . $suga]); } else { $raukums = raukums_2_array($this->MyPOST['raukums' . $this->grup]); } if ($suga && $this->MyPOST['dalit_koeficients' . $this->grup]) { $koeficients = $this->MyPOST['koeficients' . $this->grup . '_' . $suga]; } else { $koeficients = $this->MyPOST['koeficients' . $this->grup]; } if ($typ != 'string') { $mbounds = explode('-', $a[$row]); } if (count($mbounds) > 1) { $low_range_brakis = 0; $high_range_brakis = 0; if ($mbounds[0] > 5) { $low_range_brakis = $mbounds[0]; } else { $low_range_brakis = $mbounds[0]; } if ($mbounds[1] < 994) { $high_range_brakis = $mbounds[1]; } else { $high_range_brakis = $mbounds[1]; } //pievienots 17.07.2007 if ($this->MyPOST["gtype" . $this->grup . $level] == 'mind_pirms_red') { $myquery = $query . " and ((" . $this->MyPOST["gtype" . $this->grup . $level] . ">=" . $mbounds[0] . " and " . $this->MyPOST["gtype" . $this->grup . $level] . "<=" . $mbounds[1] . " AND nelss_balkis_temp.import_type <> 'zbm') or (" . $this->MyPOST["gtype" . $this->grup . $level] . ">=" . $low_range_brakis . " and " . $this->MyPOST["gtype" . $this->grup . $level] . "<=" . $high_range_brakis . " AND nelss_balkis_temp.import_type = 'zbm'))"; } else { $myquery = $query . " and (" . $this->MyPOST["gtype" . $this->grup . $level] . ">=" . $mbounds[0] . " and " . $this->MyPOST["gtype" . $this->grup . $level] . "<=" . $mbounds[1] . ")"; } //echo 'adding to query = ' . $query . " and (". $this->MyPOST["gtype".$this->grup.$level] . ">=" . $mbounds[0] ." and " . $this->MyPOST["gtype".$this->grup.$level] . "<=" . $mbounds[1] . ")" . '<br />'; //echo '$myquery = ' . $myquery . '<br />'; //$myquery = $query . " and (". $this->MyPOST["gtype".$this->grup.$level] . ">=" . $mbounds[0] ." and " . $this->MyPOST["gtype".$this->grup.$level] . "<=" . $mbounds[1] . ")"; } else { if ($typ == 'string') { $myquery = $query . " and " . $this->MyPOST["gtype" . $this->grup . $level] . "='" . $a[$row] . "'"; } else { $myquery = $query . " and " . $this->MyPOST["gtype" . $this->grup . $level] . "=" . $a[$row]; } } $row = $row + 1; if ($this->rowclosed == true) { $this->rowclosed = false; $this->arr_index++; $this->arr[$this->arr_index] = array(); } if ($level == 1) { $this->arr[$this->arr_index][0] = ""; } else { if ($row > 1) { for ($i = 1; $i < $level + 1; $i++) { $this->arr[$this->arr_index][$i - 1] = ""; } } } $irbrakis = false; if ($irbrakis_p == true) { $irbrakis = true; } // Ja ir v?l dzi??ki l?me?i if ($level < $this->lsk) { if (!$val || $val == '') { $this->arr[$this->arr_index][$level - 1] = "nav"; } else { $this->arr[$this->arr_index][$level - 1] = $this->kodi($this->MyPOST['gtype' . $this->grup . $level], $val); } $sum = new CSumma(); if (strlen($abr[$key]) == 1) { $irbrakis = true; $brkods = $abr[$key]; } //$rrow = mysql_query("select * from gatskaite where rowid = '".dig3($id).dig3($myid)."'"); //if ($mrow = mysql_fetch_array($rrow)) //{ // $saved = 1; // $x = unserialize($mrow['data']); // $sum = $x[summa]; //} //else //{ //} $this->print_level($level + 1, $myquery, $sum, $irbrakis, $suga, $id . $myid); /* Testa nolūkiem */ // Te saskaita kop? par l?meni summu - XML varianta tas nav jadara if (!$this->XML_Variants) { $this->arr_index++; $this->arr[$this->arr_index] = array(); if ($sum->bruto) { $this->arr[$this->arr_index][-1] = $translate['kopa'][$lang]; for ($i = 0; $i < $this->lsk; $i++) { if ($level == $i + 1) { $this->arr[$this->arr_index][$i] = $this->kodi($this->MyPOST['gtype' . $this->grup . $level], $val); } else { $this->arr[$this->arr_index][$i] = ""; } } if (!$this->MyPOST['negrupet']) { $this->arr[$this->arr_index][summa] = $sum; } //echo "<tr><td height=1 colspan=".(7+$this->lsk)."><hr></tr>"; } } $this->rowclosed = true; if (!$this->MyPOST['negrupet']) { $summa_p->add_skaits($sum->skaits); $summa_p->add_skaits_bad($sum->skaits_bad); $summa_p->add_virsmers($sum->virsmers); $summa_p->add_redukcija_d($sum->redukcija_d); $summa_p->add_redukcija_l($sum->redukcija_l); $summa_p->add_brakis($sum->brakis); $summa_p->add_neto($sum->neto); $summa_p->add_bruto($sum->bruto); //print_r($summa_p); $this->lasttype = 'sum'; } } else { $this->lasttype = 'data'; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Saakums//////////////////////////////////////////////////////////////////////////////////// if ($this->MyPOST['metode'] == '1') { /*Query izvilksana*/ $tbl_field_identity = ""; $tbl_field_mind_pirms_red = ""; $tbl_field_garums = ""; $tbl_field_mind_pec_red = ""; $tbl_field_gar_pec_red = ""; $tbl_field_brakis = ""; $tbl_field_cenu_matrica = ""; $query__ = "select nelss_balkis_temp.id as Ident, mind_pirms_red as DBruto, garums as LBruto, mind_pec_red as DPecReduc, gar_pec_red as LPecReduc, brakis, nelss_pavadzime.cenu_matrica as cm " . $myquery; $r = $this->DB->query($query__); $SVBruto = 0; $SVReducD = 0; $SVReducL = 0; $SVVirsm = 0; $SVNeto = 0; $SVBrakis = 0; $SSkaits = 0; $SSkaitsBad = 0; $gostu_tabula = $this->MyPOST['gostu_tabula' . $this->grup]; while ($m = $this->DB->get_row($r)) { $SSkaits++; /*Vai ir Vika Wood*/ $min_virsmers = $this->MyPOST['virsmers' . $this->grup] / 100; if ($suga && $this->MyPOST['dalit_virsmers' . $this->grup]) { $min_virsmers = $this->MyPOST['virsmers' . $this->grup . '_' . $suga] / 100; } $DBruto = $m['DBruto'] / 1000; /*Noapalosana Test*/ if ($this->MyPOST['noapalot_garumu'] == '1') { $LBruto = floor($m['LBruto'] / 10) / 10; } elseif ($this->MyPOST['noapalot_garumu'] == '2') { $LBruto = (floor($m['LBruto'] / 10) + 0.5) / 10; } else { $LBruto = $m['LBruto'] / 100; } $rauk_koef = get_raukums_no_diam($raukums, $DBruto * 1000); $DPecReduc = $m['DPecReduc'] / 1000; $DReduc = $DBruto - $DPecReduc; $VBruto = f2($DBruto, $LBruto, $rauk_koef, $koeficients, $gostu_tabula); $VBezReducD = f2($DPecReduc, $LBruto, $rauk_koef, $koeficients, $gostu_tabula); $DBrutoNoap = $m['DBruto'] / 1000; if ($this->MyPOST['noapalot_diametru'] == 'on') { $DBrutoNoap = (floor($m['DBruto'] / 10) + 0.5) / 100; } if ($m[brakis] != '255') { $irbrakis = true; $brkods = 'standart'; } if ($this->MyPOST['is_vika'] == 'on') { $LNeto = $m['LPecReduc'] / 100; $LNom = nom($LBruto, $virsmeri, $min_virsmers); $LPecVirsm = $LNom; $LReduc = round($LPecVirsm - $LNeto, 3); $LVirsm = round($LBruto - $LPecVirsm, 3); $VBezVirsm = f2($DPecReduc, $LBruto - $LVirsm, $rauk_koef, $koeficients, $gostu_tabula); $VBezVirsmNeredD = f2($DBruto, $LBruto - $LVirsm, $rauk_koef, $koeficients, $gostu_tabula); if (!$irbrakis) { $VVirsm = $VBezReducD - $VBezVirsm; } else { $VVirsm = $VBruto - $VBezVirsmNeredD; // $VVirsm = $VBezReducD-$VBezVirsm; } $VBezReducL = f2($DPecReduc, $LPecVirsm - $LReduc, $rauk_koef, $koeficients, $gostu_tabula); $VReducL = $VBezVirsm - $VBezReducL; } else { $LPecReduc = $m['LPecReduc'] / 100; if ($this->MyPOST['noapalot_garumu'] == '1') { $LPecReduc = floor($m['LPecReduc'] / 10) / 10; $LNeap = $m['LPecReduc'] / 100; } $LNom = nom($LNeap, $virsmeri, $min_virsmers); $LNeto = $LNom; $LVirsm = round($LPecReduc - $LNeto, 3); $LReduc = round($LBruto - $LPecReduc, 3); $VBruto_redukcija = f2($DBruto, $LNom, $rauk_koef, $koeficients, $gostu_tabula); $VBezReducD_redukcija = f2($DPecReduc, $LNom, $rauk_koef, $koeficients, $gostu_tabula); $VReducD = $VBruto_redukcija - $VBezReducD_redukcija; $VBezReducL = f2($DBrutoNoap, $LBruto - $LReduc, $rauk_koef, $koeficients, $gostu_tabula); $VReducL = $VBruto - $VBezReducL; $VBezReduc = f2($DPecReduc, $LPecReduc, $rauk_koef, $koeficients, $gostu_tabula); $VBezVirsm = f2($DPecReduc, $LPecReduc - $LVirsm, $rauk_koef, $koeficients, $gostu_tabula); $VBezVirsmNeredD = f2($DBruto, $LPecReduc - $LVirsm, $rauk_koef, $koeficients, $gostu_tabula); $VVirsm = $VBruto - $VBezVirsmNeredD; } $SVBruto += $VBruto; if ($gostu_tabula) { if ($VBruto == -1 || $VReducD == -1 || $VReducL == -1 || $VVirsm == -1) { $SSkaitsBad++; } if ($VBruto == -1) { $VBruto = 0; } if ($VReducD == -1) { $VReducD = 0; } if ($VReducL == -1) { $VReducL = 0; } if ($VVirsm == -1) { $VVirsm = 0; } } $VBrakis = 0; if (strlen($abr[$key]) == 1) { $irbrakis = true; $brkods = $abr[$key]; } if (!$irbrakis) { /*Vai ir brakis?*/ if ($LNom != 0) { $SVVirsm += $VVirsm; //$SVNeto += f2($DPecReduc,$LNeto,$rauk_koef,$koeficients,$gostu_tabula); $SVNeto += $VBruto - $VReducL - $VReducD - $VVirsm; $SVReducD += $VReducD; $SVReducL += $VReducL; } else { $SVBrakis += $VBruto; } } else { if ($LNom != 0) { if ($this->MyPOST['braka_virsmers'] == 'on') { $SVVirsm += $VVirsm; $VBrakis = $VBruto - $VVirsm; } else { $VBrakis = $VBruto; } $SVBrakis += $VBrakis; } else { $VBrakis = $VBruto; $SVBrakis += $VBrakis; } } } //-------------------------------------------TEST-Line-> } elseif ($this->MyPOST['metode'] == '2') { } elseif ($this->MyPOST['metode'] == '3') { } else { } // $this->arr[$this->arr_index][$level-3] = $this->kodi($this->MyPOST['gtype'.$this->grup.$this->lsk],$val); // echo $this->arr[$this->arr_index][$level]; /* Testēšanas nolūkiem */ if (!$this->MyPOST['negrupet']) { $this->arr[$this->arr_index][b_kods] = $this->kodi($this->MyPOST['gtype' . $this->grup . $this->lsk], $val); $sm = new CSumma(); $sm->skaits = $SSkaits; $sm->skaits_bad = $SSkaitsBad; $sm->virsmers = $SVVirsm; $sm->redukcija_d = $SVReducD; $sm->redukcija_l = $SVReducL; $sm->brakis = $SVBrakis; $sm->neto = $SVNeto; $sm->bruto = $SVBruto; $this->arr[$this->arr_index][summa] = $sm; $this->rowclosed = true; $summa_p->add_skaits($SSkaits); $summa_p->add_skaits_bad($SSkaitsBad); $summa_p->add_virsmers($SVVirsm); $summa_p->add_redukcija_d($SVReducD); $summa_p->add_redukcija_l($SVReducL); $summa_p->add_brakis($SVBrakis); $summa_p->add_neto($SVNeto); $summa_p->add_bruto($SVBruto); } } } /* */ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////Beigas///////////////////////////////////////////// // "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"; // Aizpild?m tuk?umus // "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"; if ($this->lsk > 1) { for ($j = $this->lsk - 2; $j >= 0; $j--) { $v = $this->arr[0][$j]; for ($i = 0; $i < count($this->arr); $i++) { // iekop?jam ja tuk?s if ($this->arr[$i][$j] == "" && $this->arr[$i][$j + 1] != "") { $this->arr[$i][$j] = $v; } // ja nav tuk?s pa?em v?rt?bu if ($this->arr[$i][$j] != "") { $v = $this->arr[$i][$j]; } } } } }
function constrByMask($pvdzID) { $tmp_rowCount = 1; $tilpums_bruto_KOPA = 0; $tilpums_virsmers_KOPA = 0; $tilpums_redukcija_KOPA = 0; $tilpums_neto_KOPA = 0; $tilpums_brakis_KOPA = 0; $tmp_balkuSkaits = 0; $tilpums_skaits_brakis_KOPA = 0; $bbq_temp = false; $tmp_arrCollName['nosaukums'] = 1; $tmp_arrCollName['suga'] = "Suga"; $tmp_arrCollName['skira'] = "Šķira"; $tmp_arrCollName['diametrs'] = "Diametrs"; $tmp_arrCollName['garums'] = "Garums"; $tmp_arrCollName['brakis_kods'] = "Brāķa iemesls"; $tmp_arrCollName['skaits'] = "Skaits"; $tmp_arrCollName['bruto'] = "Bruto"; $tmp_arrCollName['virsmers'] = "Virsmērs"; $tmp_arrCollName['redukcija'] = "Redukcija"; $tmp_arrCollName['redukcija_un_virsmers'] = "Red. un virsm."; $tmp_arrCollName['brakis'] = "Brāķis"; $tmp_arrCollName['neto'] = "Neto"; $tmp_arrCollName['brakis_un_neto'] = "Brāķis un Neto"; $tmp_getDataQuery_txt = "SELECT * FROM " . $this->tblName . "balkis_temp WHERE pavadzime = " . $pvdzID . " ORDER BY mind_pirms_red"; if (!$pvdzID) { $tmp_getDataQuery_txt = "SELECT * FROM " . $this->tblName . "balkis_temp ORDER BY mind_pirms_red"; $bbq_temp = true; } $tmp_getDataQuery_query = mysql_query($tmp_getDataQuery_txt); /* While($tmp_getDataQuery_arr_tmp = mysql_fetch_assoc($tmp_getDataQuery_query)){ $tmp_getDataQuery_arr_tmp_first[] = $tmp_getDataQuery_arr_tmp; $tmp_getDataQuery_arr_tmp_second[] = $tmp_getDataQuery_arr_tmp; } $tmp_getDataQuery_arr_tmp_third = array_chunk($tmp_getDataQuery_arr_tmp_second,500); foreach($tmp_getDataQuery_arr_tmp_third as $item_ttt){ foreach($item_ttt as $tmp_getDataQuery_arr){ */ /* $part_count = 0; $tmp_getDataQuery_txt_temp = run_mysql_by_partitions($part_count,$tmp_getDataQuery_txt); $tmp_getDataQuery_query = mysql_query($tmp_getDataQuery_txt_temp); while(mysql_num_rows($tmp_getDataQuery_query) > 1){ $tmp_getDataQuery_txt_temp = run_mysql_by_partitions($part_count,$tmp_getDataQuery_txt); $tmp_getDataQuery_query = mysql_query($tmp_getDataQuery_txt_temp); $part_count++; */ while ($tmp_getDataQuery_arr = mysql_fetch_assoc($tmp_getDataQuery_query)) { $tilpums_bruto = 0; $tilpums_virsmers = 0; $tilpums_redukcija = 0; $tilpums_neto = 0; $tilpums_brakis = 0; $isBrakaVirsmOn = $this->MyPOST['braka_virsmers']; if ($tmp_getDataQuery_arr['pavadzime'] == 76806 && $this->firmCode == 2) { $isBrakaVirsmOn = 'off'; } //-#001-FUNC-START--Nepieciešamo datu kolekcionēšana no datubāzes------------------------------------------------------------------------------------ $tmp_ident_balkis = $tmp_getDataQuery_arr['id']; $var_Suga = $tmp_getDataQuery_arr['suga']; $tmp_tilpumsBruto = $tmp_getDataQuery_arr['tilpums']; $tmp_tilpumsNeto = $tmp_getDataQuery_arr['tilpums_scan']; $tmp_garums_pirms_red = $tmp_getDataQuery_arr['garums']; $tmp_garums_pec_red = $tmp_getDataQuery_arr['gar_pec_red']; $tmp_tievgalis_pirms_red = $tmp_getDataQuery_arr['mind_pirms_red']; $tmp_tievgalis_pec_red = $tmp_getDataQuery_arr['mind_pec_red']; $tmp_vidusdiametrs_pirms_red = $tmp_getDataQuery_arr['mind_miza']; $tmp_vidusdiametrs_pec_red = $tmp_getDataQuery_arr['mind_miza'] - ($tmp_getDataQuery_arr['mind_pirms_red'] - $tmp_getDataQuery_arr['mind_pec_red']); $tmp_resgalis_pirms_red = $tmp_getDataQuery_arr['maxd_miza']; $tmp_resgalis_pec_red = $tmp_getDataQuery_arr['maxd_miza'] - ($tmp_getDataQuery_arr['mind_pirms_red'] - $tmp_getDataQuery_arr['mind_pec_red']); //-#001-FUNC-END------------------------------------------------------------------------------------------------------------------------------------ //-#002-FUNC-START--Nepieciešamās grupas atrašana--------------------------------------------------------------------------------------------------- $igc = 1; // Grupu skaits $init_Group = false; while ($igc < 9 && $init_Group == false) { $tmp_igcCheck = 0; for ($igo = 1; $igo < 6; $igo++) { //Grupēšanas nosacījumus cikls for ($subcount = 0; $subcount < 3; $subcount++) { if ($this->tmpAllGroup[$igc][$this->GroupOrder[$igo]][$subcount]) { $tmp_SubResult = $this->tmpAllGroup[$igc][$this->GroupOrder[$igo]][$subcount]; if (!$this->tmpAllGroup[$igc][$this->GroupOrder[$igo]][0]) { $tmp_SubResult = $this->tmpAllGroup[$igc][$this->GroupOrder[$igo]][$var_Suga]; } $tmp_ALLbResult = $this->getMaskGroup($tmp_SubResult, $tmp_getDataQuery_arr[$this->GroupOrder[$igo]], $this->GroupOrder[$igo]); $tmp_inputArrVal[$this->GroupOrder[$igo]] = $tmp_ALLbResult; if ($tmp_ALLbResult != '') { $tmp_igcCheck = $tmp_igcCheck + 1; } } else { $tmp_igcCheck = $tmp_igcCheck + 1; } } if ($igo == 5 && $tmp_igcCheck == 15) { // Grupas noteikšana līdz pirmajiem sakritības rezultātiem (rekursija ar limitētu ciklu skaitu) $init_Group = true; $globalGroupIdent = $igc; } } $igc++; } //-#002-FUNC-END------------------------------------------------------------------------------------------------------------------------------------- //-#003-FUNC-START--Tilpuma aprēķināšana------------------------------------------------------------------------------------------------------------- $prnt_Nosaukums = 0; $prnt_Suga = $this->sugas[$var_Suga]['LAT']; $prnt_Skira = $tmp_getDataQuery_arr['skira']; $prnt_Brakis = $this->braki[$tmp_getDataQuery_arr['brakis']]['LAT']; $prnt_Diametrs = $tmp_inputArrVal['mind_pirms_red']; $prnt_Garums = $tmp_inputArrVal['garums']; //--------------------------------------------------------------------------------------------------------------------------------------------------- if ($this->firmCode == 35 && $prnt_Skira == 3) { $prnt_Skira = 9; $prnt_Brakis = $this->braki['010']['LAT']; } //--------------------------------------------------------------------------------------------------------------------------------------------------- if ($this->MyPOST['noapalot_garumu'] == '1') { $tmp_garums_pirms_red = floor($tmp_garums_pirms_red / 10) * 10; } elseif ($this->MyPOST['noapalot_garumu'] == '2') { $tmp_garums_pirms_red = (floor($tmp_garums_pirms_red / 10) + 0.5) * 10; } $tmp_raukumaRinda = $this->tmpRaukGroup[$globalGroupIdent][0]; if (!$tmp_raukumaRinda) { $tmp_raukumaRinda = $this->tmpRaukGroup[$globalGroupIdent][$var_Suga]; } $raukums = raukums_2_array($tmp_raukumaRinda); $rauk_koef = get_raukums_no_diam($raukums, $tmp_tievgalis_pirms_red); $tmp_DiamRedukcija = $tmp_tievgalis_pirms_red - $tmp_tievgalis_pec_red; $tilpums_bruto = $this->calc_Volume($tmp_tievgalis_pirms_red, $tmp_vidusdiametrs_pirms_red, $tmp_resgalis_pirms_red, $tmp_garums_pirms_red, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']); if ($this->MyPOST['noapalot_diametru'] == 'on') { $tmp_tievgalis_pec_red = (floor($tmp_tievgalis_pec_red / 10) + 0.5) * 100; } $tmp_virsmeraRinda = $this->tmpNomGarGroup[$globalGroupIdent][0]; if (!$tmp_virsmeraRinda) { $tmp_virsmeraRinda = $this->tmpNomGarGroup[$globalGroupIdent][$var_Suga]; } $tmp_virsmeraRindaBrakis = $this->tmpNomGarBrakGroup[$globalGroupIdent][0]; if (!$tmp_virsmeraRindaBrakis) { $tmp_virsmeraRindaBrakis = $this->tmpNomGarBrakGroup[$globalGroupIdent][$var_Suga]; } if ($tmp_virsmeraRindaBrakis) { $virsmeri_brakim = explode(',', $tmp_virsmeraRindaBrakis); for ($i = 0; $i < count($virsmeri_brakim); $i++) { $virsmeri_brakim[$i] = $virsmeri_brakim[$i]; } } $virsmeri = explode(',', $tmp_virsmeraRinda); for ($i = 0; $i < count($virsmeri); $i++) { $virsmeri[$i] = $virsmeri[$i]; } $tmp_mini_virsmeraRinda = $this->tmpVirsmGroup[$globalGroupIdent][0]; if (!$tmp_mini_virsmeraRinda) { $tmp_mini_virsmeraRinda = $this->tmpVirsmGroup[$globalGroupIdent][$var_Suga]; } $tmp_nom_garums_pirms_red = nominalGarums($tmp_getDataQuery_arr['garums'], $virsmeri, $tmp_mini_virsmeraRinda); $tmp_nom_garums_pec_red = nominalGarums($tmp_garums_pec_red, $virsmeri, $tmp_mini_virsmeraRinda); if ($this->MyPOST['is_vika'] == 'on') { $tmp_garums_pec_red = $tmp_garums_pec_red + $tmp_mini_virsmeraRinda; $tmp_nom_garums_pec_red = nominalGarums($tmp_garums_pec_red, $virsmeri, $tmp_mini_virsmeraRinda); $tilpums_neto = $this->calc_Volume($tmp_tievgalis_pec_red, $tmp_vidusdiametrs_pec_red, $tmp_resgalis_pec_red, $tmp_nom_garums_pec_red, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']); $tilpums_bruto_virsmeram = $this->calc_Volume($tmp_tievgalis_pirms_red, $tmp_vidusdiametrs_pirms_red, $tmp_resgalis_pirms_red, $tmp_nom_garums_pirms_red, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']); $tilpums_virsmers = ROUND($tilpums_bruto - $tilpums_bruto_virsmeram, 3); $tilpums_redukcija = $tilpums_bruto_virsmeram - $tilpums_neto; } else { $tilpums_neto = $this->calc_Volume($tmp_tievgalis_pec_red, $tmp_vidusdiametrs_pec_red, $tmp_resgalis_pec_red, $tmp_nom_garums_pec_red, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']); $tilpums_bruto_virsmeram = $this->calc_Volume($tmp_tievgalis_pirms_red, $tmp_vidusdiametrs_pirms_red, $tmp_resgalis_pirms_red, $tmp_nom_garums_pirms_red, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']); $tilpums_virsmers = ROUND($tilpums_bruto - $tilpums_bruto_virsmeram, 3); $tilpums_redukcija = $tilpums_bruto_virsmeram - $tilpums_neto; } if ($this->MyPOST['metode'] == 4) { if ($this->firmCode == 27) { $tilpums_bruto = floor($tmp_tilpumsBruto / 10) / 1000; $tilpums_neto = floor($tmp_tilpumsNeto / 10) / 1000; $tilpums_bruto_virsmeram = floor($tmp_tilpumsNeto / 10) / 1000; $tilpums_virsmers = $tilpums_bruto - $tilpums_bruto_virsmeram; $tilpums_redukcija = 0; } else { $tilpums_bruto = $tmp_tilpumsBruto; $tilpums_neto = $tmp_tilpumsNeto; $tilpums_bruto_virsmeram = $tmp_tilpumsNeto; $tilpums_virsmers = $tilpums_bruto - $tilpums_bruto_virsmeram; $tilpums_redukcija = 0; } } if ($tilpums_virsmers < 0) { $tilpums_virsmers = 0; } if ($tilpums_bruto_virsmeram == 0) { $tilpums_virsmers = 0; } if ($tilpums_redukcija < 0) { $tilpums_redukcija = 0; } //-#003-FUNC-END-------------------------------------------------------------------------------------------------------------------------------------- //-#004-FUNC-START--Papildus dimensijas brāķa priešķiršana-------------------------------------------------------------------------------------------- $takeReCallOn4 = false; if ($tmp_nom_garums_pec_red < 1 && !$prnt_Brakis) { $prnt_Skira = 9; $prnt_Brakis = $this->braki['899']['LAT']; $takeReCallOn4 = true; } if (substr($prnt_Diametrs, 0, 1) == 'b' && !$prnt_Brakis) { $prnt_Skira = 9; $prnt_Brakis = $this->braki['899']['LAT']; $prnt_Diametrs = str_replace('b', '', $prnt_Diametrs); $takeReCallOn4 = true; } if (substr($prnt_Garums, 0, 1) == 'b' && !$prnt_Brakis) { $prnt_Skira = 9; $prnt_Brakis = $this->braki['899']['LAT']; $prnt_Garums = str_replace('b', '', $prnt_Garums); $takeReCallOn4 = true; } if ($prnt_Brakis == 'D') { // XML nobrāķēšana ar 4 kodu $takeReCallOn4 = true; } if ($takeReCallOn4) { $tmp_is4 = mod_ResignLVMRejectCode($this->firmCode, $tmp_getDataQuery_arr['garums'], $tmp_getDataQuery_arr['mind_pirms_red'], $tmp_getDataQuery_arr['suga'], $tmp_getDataQuery_arr['skira']); if ($tmp_is4) { $prnt_Brakis = $this->braki['856']['LAT']; } } //-#004-FUNC-END----------------------------------------------------------------------------------------------------- //-#005-FUNC-START--Brāķa tilpuma aprēķināšana--------------------------------------------------------------------------------------------------- if ($prnt_Brakis) { $tilpums_neto = 0; $tilpums_redukcija = 0; if ($isBrakaVirsmOn == 'on') { if ($virsmeri_brakim) { $tmp_nom_garums_pirms_red_brakim = nominalGarums($tmp_getDataQuery_arr['garums'], $virsmeri_brakim, $tmp_mini_virsmeraRinda); $tilpums_bruto_virsmeram = $this->calc_Volume($tmp_tievgalis_pirms_red, $tmp_vidusdiametrs_pirms_red, $tmp_resgalis_pirms_red, $tmp_nom_garums_pirms_red_brakim, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']); if ($tilpums_bruto_virsmeram > 0) { $tilpums_virsmers = $tilpums_bruto - $tilpums_bruto_virsmeram; $tilpums_brakis = $tilpums_bruto_virsmeram; } else { $tilpums_virsmers = 0; $tilpums_brakis = $tilpums_bruto; } } else { if ($tilpums_bruto_virsmeram > 0) { $tilpums_brakis = $tilpums_bruto_virsmeram; } else { $tilpums_virsmers = 0; $tilpums_brakis = $tilpums_bruto; } } } else { $tilpums_virsmers = 0; $tilpums_brakis = $tilpums_bruto; } } $tmp_inputArrVal['mind_pirms_red'] = str_replace('b', '', $tmp_inputArrVal['mind_pirms_red']); $prnt_Diametrs = str_replace('b', '', $prnt_Diametrs); $tmp_inputArrVal['garums'] = str_replace('b', '', $tmp_inputArrVal['garums']); $prnt_Garums = str_replace('b', '', $prnt_Garums); //-#005-FUNC-END----------------------------------------------------------------------------------------------------- //-#006-FUNC-START--Vienādo grupēšanu pāskats--------------------------------------------------------------------------------------------------- $pilnaGrupesana = false; if ($this->report_XML) { $pilnaGrupesana = true; } if (($this->firmCode == 16 || $this->firmCode == 18 || $this->isAllReport) && !$this->report_PDF) { $pilnaGrupesana = true; } $rowExist = 0; if (!$pilnaGrupesana) { for ($protoKey = $tmp_rowCount - 1; $protoKey > 0; $protoKey--) { if ($this->arrPrintOut[$protoKey]['suga'] == $prnt_Suga) { if ($this->arrPrintOut[$protoKey]['skira'] == $prnt_Skira) { if ($this->arrPrintOut[$protoKey]['diametrs'] == $prnt_Diametrs) { if ($this->arrPrintOut[$protoKey]['brakis_kods'] == $prnt_Brakis) { $rowExist = $protoKey; } } } } } } else { for ($protoKey = $tmp_rowCount - 1; $protoKey > 0; $protoKey--) { if ($this->arrPrintOut[$protoKey]['suga'] == $prnt_Suga) { if ($this->arrPrintOut[$protoKey]['skira'] == $prnt_Skira) { if ($this->arrPrintOut[$protoKey]['diametrs'] == $prnt_Diametrs) { if ($this->arrPrintOut[$protoKey]['garums'] == $prnt_Garums) { if ($this->arrPrintOut[$protoKey]['brakis_kods'] == $prnt_Brakis) { $rowExist = $protoKey; } } } } } } } //-#006-FUNC-END----------------------------------------------------------------------------------------------------- //-#007-FUNC-START--Statisko vērtību ievietošana--------------------------------------------------------------------------------------------------- $insertRow = $tmp_rowCount; if ($rowExist != 0) { $insertRow = $rowExist; } $this->arrPrintOut[$insertRow]['nosaukums'] = 0; $this->arrPrintOut[$insertRow]['suga'] = $prnt_Suga; $this->arrPrintOut[$insertRow]['skira'] = $prnt_Skira; $this->arrPrintOut[$insertRow]['diametrs'] = $prnt_Diametrs; $this->arrPrintOut[$insertRow]['garums'] = $prnt_Garums; $this->arrPrintOut[$insertRow]['brakis_kods'] = $prnt_Brakis; if ($this->report_XML) { $this->arrPrintOut[$insertRow]['diametrs_tmp'] = $tmp_getDataQuery_arr['mind_pirms_red']; $this->arrPrintOut[$insertRow]['garums_tmp'] = $tmp_getDataQuery_arr['garums']; } $this->arrPrintOut[$insertRow]['skaits'] += 1; if ($this->arrPrintOut[$insertRow]['brakis_kods'] != '') { $tilpums_skaits_brakis_KOPA += 1; } //-#007-FUNC-END----------------------------------------------------------------------------------------------------- //-#008-FUNC-START--Dinamisko vērtību piešķiršana--------------------------------------------------------------------------------------------------- $this->arrPrintOut[$insertRow]['bruto'] += $tilpums_bruto; $this->arrPrintOut[$insertRow]['virsmers'] += $tilpums_virsmers; $this->arrPrintOut[$insertRow]['redukcija'] += $tilpums_redukcija; $this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] += $tilpums_bruto - $tilpums_neto; $this->arrPrintOut[$insertRow]['brakis'] += $tilpums_brakis; $this->arrPrintOut[$insertRow]['neto'] += $tilpums_neto; $this->arrPrintOut[$insertRow]['brakis_un_neto'] += $tilpums_neto + $tilpums_brakis; //------------------------------------------------------------------------------------------------------ if ($this->arrPrintOut[$insertRow]['bruto'] != '') { $this->arrPrintOut[$insertRow]['bruto'] = number_format($this->arrPrintOut[$insertRow]['bruto'], 3, '.', ''); } else { $this->arrPrintOut[$insertRow]['bruto'] = ''; } if ($this->arrPrintOut[$insertRow]['virsmers'] != '') { $this->arrPrintOut[$insertRow]['virsmers'] = number_format($this->arrPrintOut[$insertRow]['virsmers'], 3, '.', ''); } else { $this->arrPrintOut[$insertRow]['virsmers'] = ''; } if ($this->arrPrintOut[$insertRow]['redukcija'] != '') { $this->arrPrintOut[$insertRow]['redukcija'] = number_format($this->arrPrintOut[$insertRow]['redukcija'], 3, '.', ''); } else { $this->arrPrintOut[$insertRow]['redukcija'] = ''; } if ($this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] != '') { $this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] = number_format($this->arrPrintOut[$insertRow]['redukcija_un_virsmers'], 3, '.', ''); } else { $this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] = ''; } if ($this->arrPrintOut[$insertRow]['brakis'] != '') { $this->arrPrintOut[$insertRow]['brakis'] = number_format($this->arrPrintOut[$insertRow]['brakis'], 3, '.', ''); } else { $this->arrPrintOut[$insertRow]['brakis'] = ''; } if ($this->arrPrintOut[$insertRow]['neto'] != '') { $this->arrPrintOut[$insertRow]['neto'] = number_format($this->arrPrintOut[$insertRow]['neto'], 3, '.', ''); } else { $this->arrPrintOut[$insertRow]['neto'] = ''; } if ($this->arrPrintOut[$insertRow]['brakis_un_neto'] != '') { $this->arrPrintOut[$insertRow]['brakis_un_neto'] = number_format($this->arrPrintOut[$insertRow]['brakis_un_neto'], 3, '.', ''); } else { $this->arrPrintOut[$insertRow]['brakis_un_neto'] = ''; } //------------------------------------------------------------------------------------------------------ $tilpums_bruto_KOPA = $tilpums_bruto_KOPA + $tilpums_bruto; $tilpums_virsmers_KOPA = $tilpums_virsmers_KOPA + $tilpums_virsmers; $tilpums_redukcija_KOPA = $tilpums_redukcija_KOPA + $tilpums_redukcija; $tilpums_neto_KOPA = $tilpums_neto_KOPA + $tilpums_neto; $tilpums_brakis_KOPA = $tilpums_brakis_KOPA + $tilpums_brakis; $tmp_balkuSkaits++; $tmp_rowCount++; } // } //-#008-FUNC-END----------------------------------------------------------------------------------------------------- //-#009-FUNC-START--Rindu pārgrupēšana masīvā--------------------------------------------------------------------------------------------------- if (($this->firmCode == 16 || $this->firmCode == 20 || $this->isAllReport) && !$this->report_PDF && !$this->report_XML) { $this->arrPrintOut = array_orderby($this->arrPrintOut, 'suga', SORT_ASC, 'skira', SORT_ASC, 'diametrs', SORT_ASC, 'garums', SORT_ASC, 'brakis_kods', SORT_ASC); } else { $this->arrPrintOut = array_orderby($this->arrPrintOut, 'suga', SORT_ASC, 'skira', SORT_ASC, 'diametrs', SORT_ASC, 'brakis_kods', SORT_ASC); } array_unshift($this->arrPrintOut, $tmp_arrCollName); //-#009-FUNC-END----------------------------------------------------------------------------------------------------- //-#010-FUNC-START--Kopsummas rindas pievienošana--------------------------------------------------------------------------------------------------- $this->arrPrintOut[$tmp_rowCount]['nosaukums'] = 1; $this->arrPrintOut[$tmp_rowCount]['suga'] = ""; $this->arrPrintOut[$tmp_rowCount]['skira'] = ""; $this->arrPrintOut[$tmp_rowCount]['diametrs'] = ""; $this->arrPrintOut[$tmp_rowCount]['garums'] = ""; $this->arrPrintOut[$tmp_rowCount]['brakis_kods'] = ""; $this->arrPrintOut[$tmp_rowCount]['skaits'] = $tmp_balkuSkaits; $this->arrPrintOut[$tmp_rowCount]['bruto'] = number_format($tilpums_bruto_KOPA, 3, '.', '') . "*"; $this->arrPrintOut[$tmp_rowCount]['virsmers'] = number_format($tilpums_virsmers_KOPA, 3, '.', '') . "*"; $this->arrPrintOut[$tmp_rowCount]['redukcija'] = number_format($tilpums_redukcija_KOPA, 3, '.', '') . "*"; $this->arrPrintOut[$tmp_rowCount]['redukcija_un_virsmers'] = number_format($tilpums_bruto_KOPA - $tilpums_neto_KOPA, 3, '.', '') . "*"; $this->arrPrintOut[$tmp_rowCount]['brakis'] = number_format($tilpums_brakis_KOPA, 3, '.', '') . "*"; $this->arrPrintOut[$tmp_rowCount]['neto'] = number_format($tilpums_neto_KOPA, 3, '.', '') . "*"; $this->arrPrintOut[$tmp_rowCount]['brakis_un_neto'] = number_format($tilpums_brakis_KOPA + $tilpums_neto_KOPA, 3, '.', '') . "*"; $this->regSuperSum['bruto'] = $tilpums_bruto_KOPA; $this->regSuperSum['virsmers'] = $tilpums_virsmers_KOPA; $this->regSuperSum['redukcija'] = $tilpums_redukcija_KOPA; $this->regSuperSum['brakis'] = $tilpums_brakis_KOPA; $this->regSuperSum['neto'] = $tilpums_neto_KOPA; $this->regSuperSum['skaits'] = $tmp_balkuSkaits; $this->regSuperSum['skaits_brakis'] = $tilpums_skaits_brakis_KOPA; //-#010-FUNC-END----------------------------------------------------------------------------------------------------- //-#011-FUNC-START-END-Rezultāts--------------------------------------------------------------------------------------------------- // fb($this->arrPrintOut,'arrPrintOut'); // break; return true; }
function print_level($level, $query, &$summa_p, $irbrakis_p, $suga) { $lauks = $this->MyPOST["gtype" . $level]; ////////////////////////////////////////////////////////////////// JA IR DAL?JUMS PA SUG?M ////////////////// if ($lauks == 'garums' || $lauks == 'mind_pirms_red') { // ja ir sadal?jums pa sug?m if ($this->MyPOST["dalit" . $level] && $suga) { $gvalues = "gvalues" . $level . "_" . $suga; } else { $gvalues = "gvalues" . $level; } $a = explode(',', $this->MyPOST[$gvalues]); $a = str_replace(' ', '', $a); // brāķis $abr = array(); for ($i = 0; $i < count($a); $i++) { if (substr($a[$i], 0, 1) == 'b' || substr($a[$i], 0, 1) == 'B') { $abr[$i] = '1'; //kursh masiva elements apzime braki $a[$i] = substr($a[$i], 1); //masiva elements bez B prieksa } } } ////////////////////////////////////////////////////////////////// JA IR DAL?JUMS PA SUG?M ////////////////// if ($lauks == 'fsc') { $a = array(); $a[0] = '0'; $a[1] = '1'; $typ = 'string'; } if ($lauks == 'kad_piegad' || $lauks == 'auto' || $lauks == 'brakis' || $lauks == 'cenu_matrica' || $lauks == 'cirsmas_kods' || $lauks == 'kad_piegad' || $lauks == 'kravas_id' || $lauks == 'pavadzime.pavadzime' || $lauks == 'piegad_kods' || $lauks == 'soferis' || $lauks == 'skira' || $lauks == 'suga' || $lauks == 'iecirknis') { //no visiem atlas?tajiem ba??iem pavadz?m? atlasa attiec?g? lauka atrodam?s v?rt?bas (pa vienai) $a = array(); $query__ = "select DISTINCT {$lauks} as lauks " . $query . " order by {$lauks} "; $r = $this->DB->query($query__); $ii = 0; while ($m = $this->DB->get_row($r)) { $a[$ii] = $m['lauks']; $ii++; } if ($lauks == 'brakis') { if ($a[count($a) - 1] == '255') { for ($j = count($a) - 1; $j > 0; $j--) { $a[$j] = $a[$j - 1]; } $a[0] = '255'; } } $typ = 'string'; } $row = 0; $summa_p->init(); while (list($key, $val) = each($a)) { if ($lauks == 'suga') { $suga = $val; } // virsm?ru sadal?jums if ($suga && $this->MyPOST['dalit_virsmeri']) { if ($this->MyPOST['virsmeri_' . $suga] != '') { $virsmeri = explode(',', $this->MyPOST['virsmeri_' . $suga]); for ($i = 0; $i < count($virsmeri); $i++) { $virsmeri[$i] = $virsmeri[$i] / 100; } } } else { if ($this->MyPOST['virsmeri'] != '') { $virsmeri = explode(',', $this->MyPOST['virsmeri']); for ($i = 0; $i < count($virsmeri); $i++) { $virsmeri[$i] = $virsmeri[$i] / 100; } } } if ($suga && $_POST[dalit_raukums]) { $raukums = raukums_2_array($_POST['raukums_' . $suga]); } else { $raukums = raukums_2_array($_POST['raukums']); } if ($suga && $this->MyPOST[dalit_koeficients]) { $koeficients = $this->MyPOST['koeficients_' . $suga]; } else { $koeficients = $this->MyPOST['koeficients']; } if ($typ != 'string') { $mbounds = explode('-', $a[$row]); } if (count($mbounds) > 1) { $myquery = $query . " and (" . $this->MyPOST["gtype" . $level] . ">=" . $mbounds[0] . " and " . $this->MyPOST["gtype" . $level] . "<=" . $mbounds[1] . ")"; } else { if ($typ == 'string') { $myquery = $query . " and " . $this->MyPOST["gtype" . $level] . "='" . $a[$row] . "'"; } else { $myquery = $query . " and " . $this->MyPOST["gtype" . $level] . "=" . $a[$row]; } } $row = $row + 1; if ($this->rowclosed == true) { $this->rowclosed = false; $this->arr_index++; $this->arr[$this->arr_index] = array(); } if ($level == 1) { $this->arr[$this->arr_index][0] = ""; } else { if ($row > 1) { for ($i = 1; $i < $level + 1; $i++) { $this->arr[$this->arr_index][$i - 1] = ""; } } } $irbrakis = false; if ($irbrakis_p == true) { $irbrakis = true; } // Ja ir v?l dzi??ki l?me?i if ($level < $this->lsk) { if (!$val || $val == '') { $this->arr[$this->arr_index][$level - 1] = "nav"; } else { $this->arr[$this->arr_index][$level - 1] = $this->kodi($this->MyPOST['gtype' . $level], $val); } $sum = new CSumma(); if (strlen($abr[$key]) == 1) { $irbrakis = true; $brkods = $abr[$key]; } $this->print_level($level + 1, $myquery, $sum, $irbrakis, $suga); // Te saskaita kop? par l?meni summu - XML varianta tas nav jadara if (!$this->XML_Variants) { $this->arr_index++; $this->arr[$this->arr_index] = array(); if ($sum->bruto) { $this->arr[$this->arr_index][-1] = "Kopā"; for ($i = 0; $i < $this->lsk; $i++) { if ($level == $i + 1) { $this->arr[$this->arr_index][$i] = $this->kodi($this->MyPOST['gtype' . $level], $val); } else { $this->arr[$this->arr_index][$i] = ""; } } $this->arr[$this->arr_index][summa] = $sum; //echo "<tr><td height=1 colspan=".(7+$this->lsk)."><hr></tr>"; } } $this->rowclosed = true; $summa_p->add_skaits($sum->skaits); //$summa_p->add_virsmers($sum->virsmers); //$summa_p->add_redukcija_d($sum->redukcija_d); //$summa_p->add_redukcija_l($sum->redukcija_l); //$summa_p->add_brakis($sum->brakis); //$summa_p->add_neto($sum->neto); $summa_p->add_bruto($sum->bruto); $this->lasttype = 'sum'; } else { $this->lasttype = 'data'; // ja nav dzi??k, tad apr??ina summu $query__ = "select mind_pirms_red as d1, garums as l1, mind_pec_red as d2, gar_pec_red as l2, brakis, pavadzime.cenu_matrica as cm " . $myquery; $r = $this->DB->query($query__); $bruto = 0; $virsmers = 0; $redukcija_d = 0; $redukcija_l = 0; $brakis = 0; $neto = 0; $skaits = 0; while ($m = $this->DB->get_row($r)) { $skaits++; $d1 = $m[d1] / 1000; $d2 = $m[d2] / 1000; $l1 = $m[l1] / 100; $l2 = $m[l2] / 100; if (count($virsmeri) > 0) { $l3 = 0; for ($i = 0; $i < count($virsmeri); $i++) { if ($virsmeri[$i] <= $l2) { $l3 = $virsmeri[$i]; } } } else { $l3 = $l2; } $rauk_koef = get_raukums_no_diam($raukums, $m[d1]); $bruto_temp = f($d1, $l1, $rauk_koef, $koeficients); $bruto = $bruto + $bruto_temp; if ($m[brakis] != '255') { $irbrakis = true; $brkods = 'standart'; } if (!$irbrakis) { $redukcija_d_temp = round(f($d1, $l1, $rauk_koef, $koeficients) - f($d2, $l1, $rauk_koef, $koeficients), 3); $redukcija_l_temp = round(f($d1, $l1, $rauk_koef, $koeficients) - f($d1, $l2, $rauk_koef, $koeficients), 3); $redukcija_d = round($redukcija_d + $redukcija_d_temp, 3); $redukcija_l = round($redukcija_l + $redukcija_l_temp, 3); } $b = 0; if (strlen($abr[$key]) == 1) { $irbrakis = true; $brkods = $abr[$key]; } // ja nav br??is if (!$irbrakis) { $virsmers_temp = f($d2, $l2, $rauk_koef, $koeficients) - f($d2, $l3, $rauk_koef, $koeficients); $virsmers = $virsmers + $virsmers_temp; $neto = $neto + ($bruto_temp - $redukcija_d_temp - $redukcija_l_temp - $virsmers_temp); } else { $b = f($d1, $l1, $rauk_koef, $koeficients); $brakis = $brakis + $b; } } //izdruk? p?d?jo rindas elementu no grup??anas nosac?jumiem $this->arr[$this->arr_index][$level - 1] = $this->kodi($this->MyPOST['gtype' . $this->lsk], $val); $sm = new CSumma(); $sm->skaits = $skaits; //$sm->virsmers = $virsmers; //$sm->redukcija_d = $redukcija_d; //$sm->redukcija_l = $redukcija_l; //$sm->brakis = $brakis; //$sm->neto = $neto; $sm->bruto = $bruto; $this->arr[$this->arr_index][summa] = $sm; $this->rowclosed = true; $summa_p->add_skaits($skaits); //$summa_p->add_virsmers($virsmers); //$summa_p->add_redukcija_d($redukcija_d); //$summa_p->add_redukcija_l($redukcija_l); //$summa_p->add_brakis($brakis); //$summa_p->add_neto($neto); $summa_p->add_bruto($bruto); } } // "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"; // Aizpild?m tuk?umus // "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"; if ($this->lsk > 1) { for ($j = $this->lsk - 2; $j >= 0; $j--) { $v = $this->arr[0][$j]; for ($i = 0; $i < count($this->arr); $i++) { // iekop?jam ja tuk?s if ($this->arr[$i][$j] == "" && $this->arr[$i][$j + 1] != "") { $this->arr[$i][$j] = $v; } // ja nav tuk?s pa?em v?rt?bu if ($this->arr[$i][$j] != "") { $v = $this->arr[$i][$j]; } } } } }
function constrByMask($pvdzID) { $tmp_rowCount = 1; $tilpums_bruto_KOPA = 0; $tilpums_virsmers_KOPA = 0; $tilpums_redukcija_KOPA = 0; $tilpums_neto_KOPA = 0; $tilpums_brakis_KOPA = 0; $tmp_balkuSkaits = 0; $tilpums_skaits_brakis_KOPA = 0; $bbq_temp = false; $liguma_matrica = ''; $tmp_arrCollName['nosaukums'] = 1; $tmp_arrCollName['suga'] = "Suga"; $tmp_arrCollName['skira'] = "Šķira"; $tmp_arrCollName['diametrs'] = "Diametrs"; $tmp_arrCollName['garums'] = "Garums"; $tmp_arrCollName['brakis_kods'] = "Brāķa iemesls"; $tmp_arrCollName['skaits'] = "Skaits"; $tmp_arrCollName['bruto'] = "Bruto"; $tmp_arrCollName['virsmers'] = "Virsmērs"; $tmp_arrCollName['redukcija'] = "Redukcija"; $tmp_arrCollName['redukcija_un_virsmers'] = "Red. un virsm."; $tmp_arrCollName['brakis'] = "Brāķis"; $tmp_arrCollName['neto'] = "Neto"; $tmp_arrCollName['brakis_un_neto'] = "Brāķis un Neto"; $tmp_lig_matrica_txt = "SELECT `cenu_matrica` FROM " . $this->tblName . "pavadzime WHERE `id` = {$pvdzID}"; $tmp_lig_matrica_mysql = mysql_query($tmp_lig_matrica_txt); while ($tmp_lig_matrica_arr = mysql_fetch_assoc($tmp_lig_matrica_mysql)) { $liguma_matrica = trim($tmp_lig_matrica_arr['cenu_matrica']); } $tmp_getDataQuery_txt = "SELECT * FROM " . $this->tblName . "balkis_temp WHERE pavadzime = " . $pvdzID . " ORDER BY mind_pirms_red"; if (!$pvdzID) { $tmp_getDataQuery_txt = "SELECT * FROM " . $this->tblName . "balkis_temp ORDER BY mind_pirms_red"; $bbq_temp = true; $trunc_SQL = "DELETE FROM `global_kops_atsk`"; mysql_query($trunc_SQL); } $tmp_getDataQuery_query = mysql_query($tmp_getDataQuery_txt); if ($bbq_temp == false) { while ($tmp_getDataQuery_arr = mysql_fetch_assoc($tmp_getDataQuery_query)) { $tilpums_bruto = 0; $tilpums_virsmers = 0; $tilpums_redukcija = 0; $tilpums_neto = 0; $tilpums_brakis = 0; $apmaksas_garums = 0; $isBrakaVirsmOn = $this->MyPOST['braka_virsmers']; if ($tmp_getDataQuery_arr['pavadzime'] == 76806 && $this->firmCode == 2) { $isBrakaVirsmOn = 'off'; } //-#001-FUNC-START--Nepieciešamo datu kolekcionēšana no datubāzes------------------------------------------------------------------------------------ $tmp_ident_balkis = $tmp_getDataQuery_arr['id']; $var_Suga = (string) $tmp_getDataQuery_arr['suga']; // if($var_Suga == 0){$var_Suga = '0';} // die('test'); $varDateTime = $tmp_getDataQuery_arr['datums_laiks']; $tmp_tilpumsBruto = $tmp_getDataQuery_arr['tilpums']; $tmp_tilpumsNeto = $tmp_getDataQuery_arr['tilpums_scan']; $tmp_garums_pirms_red = $tmp_getDataQuery_arr['garums']; $tmp_garums_pec_red = $tmp_getDataQuery_arr['gar_pec_red']; $tmp_tievgalis_pirms_red = $tmp_getDataQuery_arr['mind_pirms_red']; $tmp_tievgalis_pec_red = $tmp_getDataQuery_arr['mind_pec_red']; $tmp_vidusdiametrs_pirms_red = $tmp_getDataQuery_arr['mind_miza']; $tmp_vidusdiametrs_pec_red = $tmp_getDataQuery_arr['mind_miza'] - ($tmp_getDataQuery_arr['mind_pirms_red'] - $tmp_getDataQuery_arr['mind_pec_red']); $tmp_resgalis_pirms_red = $tmp_getDataQuery_arr['maxd_miza']; $tmp_resgalis_pec_red = $tmp_getDataQuery_arr['maxd_miza'] - ($tmp_getDataQuery_arr['mind_pirms_red'] - $tmp_getDataQuery_arr['mind_pec_red']); //-#001-FUNC-END------------------------------------------------------------------------------------------------------------------------------------ if ($this->firmCode == 26 && $liguma_matrica == 'AC' && $tmp_getDataQuery_arr['skira'] == 'E' && $tmp_getDataQuery_arr['mind_pirms_red'] > 130 && $tmp_getDataQuery_arr['mind_pirms_red'] < 180) { $tmp_getDataQuery_arr['skira'] = 'B'; } // fb($this->GroupOrder,'GroupOrder'); //-#002-FUNC-START--Nepieciešamās grupas atrašana--------------------------------------------------------------------------------------------------- $igc = 1; // Grupu skaits $init_Group = false; while ($igc < 9 && $init_Group == false) { $tmp_igcCheck = 0; for ($igo = 1; $igo < 6; $igo++) { //Grupēšanas nosacījumus cikls for ($subcount = 0; $subcount < 3; $subcount++) { if ($this->tmpAllGroup[$igc][$this->GroupOrder[$igo]][$subcount]) { $tmp_SubResult = $this->tmpAllGroup[$igc][$this->GroupOrder[$igo]][$subcount]; if (!$this->tmpAllGroup[$igc][$this->GroupOrder[$igo]][0]) { $tmp_SubResult = $this->tmpAllGroup[$igc][$this->GroupOrder[$igo]][$var_Suga]; } // echo $this->GroupOrder[$igo].'<br />'; $tmp_ALLbResult = $this->getMaskGroup($tmp_SubResult, $tmp_getDataQuery_arr[$this->GroupOrder[$igo]], $this->GroupOrder[$igo]); $tmp_inputArrVal[$this->GroupOrder[$igo]] = $tmp_ALLbResult; if ($tmp_ALLbResult != '') { $tmp_igcCheck = $tmp_igcCheck + 1; } } else { $tmp_igcCheck = $tmp_igcCheck + 1; } } if ($igo == 5 && $tmp_igcCheck == 15) { // Grupas noteikšana līdz pirmajiem sakritības rezultātiem (rekursija ar limitētu ciklu skaitu) $init_Group = true; $globalGroupIdent = $igc; } } $igc++; } // echo $globalGroupIdent.'<br/>'; //-#002-FUNC-END------------------------------------------------------------------------------------------------------------------------------------- //-#003-FUNC-START--Tilpuma aprēķināšana------------------------------------------------------------------------------------------------------------- $prnt_Nosaukums = 0; $prnt_Suga = $this->sugas[$var_Suga]['LAT']; $prnt_Skira = $tmp_getDataQuery_arr['skira']; $prnt_Brakis = $this->braki[$tmp_getDataQuery_arr['brakis']]['LAT']; $prnt_Diametrs = $tmp_inputArrVal['mind_pirms_red']; $prnt_Garums = $tmp_inputArrVal[$this->garGrupa]; // echo $prnt_Garums.'<br/>'; // echo $this->garGrupa; // $prnt_Garums = $tmp_inputArrVal['garums']; //--------------------------------------------------------------------------------------------------------------------------------------------------- if ($this->firmCode == 35 && $prnt_Skira == 3) { $prnt_Skira = 9; $prnt_Brakis = $this->braki['010']['LAT']; } if ($this->firmCode == 37 && $prnt_Skira == 3) { $prnt_Skira = 9; $prnt_Brakis = $this->braki['011']['LAT']; } //--------------------------------------------------------------------------------------------------------------------------------------------------- if ($this->MyPOST['noapalot_garumu'] == '1') { $tmp_garums_pirms_red = floor($tmp_garums_pirms_red / 10) * 10; } elseif ($this->MyPOST['noapalot_garumu'] == '2') { $tmp_garums_pirms_red = (floor($tmp_garums_pirms_red / 10) + 0.5) * 10; } $tmp_raukumaRinda = $this->tmpRaukGroup[$globalGroupIdent][0]; if (!$tmp_raukumaRinda) { $tmp_raukumaRinda = $this->tmpRaukGroup[$globalGroupIdent][$var_Suga]; } $raukums = raukums_2_array($tmp_raukumaRinda); $rauk_koef = get_raukums_no_diam($raukums, $tmp_tievgalis_pirms_red); $tmp_DiamRedukcija = $tmp_tievgalis_pirms_red - $tmp_tievgalis_pec_red; $tilpums_bruto = $this->calc_Volume($tmp_tievgalis_pirms_red, $tmp_vidusdiametrs_pirms_red, $tmp_resgalis_pirms_red, $tmp_garums_pirms_red, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']); if ($this->MyPOST['noapalot_diametru'] == 'on') { $tmp_tievgalis_pec_red = (floor($tmp_tievgalis_pec_red / 10) + 0.5) * 100; } $tmp_virsmeraRinda = $this->tmpNomGarGroup[$globalGroupIdent][0]; if (!$tmp_virsmeraRinda) { $tmp_virsmeraRinda = $this->tmpNomGarGroup[$globalGroupIdent][$var_Suga]; } $tmp_virsmeraRindaBrakis = $this->tmpNomGarBrakGroup[$globalGroupIdent][0]; if (!$tmp_virsmeraRindaBrakis) { $tmp_virsmeraRindaBrakis = $this->tmpNomGarBrakGroup[$globalGroupIdent][$var_Suga]; } if ($tmp_virsmeraRindaBrakis) { $virsmeri_brakim = explode(',', $tmp_virsmeraRindaBrakis); for ($i = 0; $i < count($virsmeri_brakim); $i++) { $virsmeri_brakim[$i] = $virsmeri_brakim[$i]; } } $virsmeri = explode(',', $tmp_virsmeraRinda); for ($i = 0; $i < count($virsmeri); $i++) { $virsmeri[$i] = $virsmeri[$i]; } $tmp_mini_virsmeraRinda = $this->tmpVirsmGroup[$globalGroupIdent][0]; if (!$tmp_mini_virsmeraRinda) { $tmp_mini_virsmeraRinda = $this->tmpVirsmGroup[$globalGroupIdent][$var_Suga]; } $tmp_nom_garums_pirms_red = nominalGarums($tmp_getDataQuery_arr['garums'], $virsmeri, $tmp_mini_virsmeraRinda); $tmp_nom_garums_pec_red = nominalGarums($tmp_garums_pec_red, $virsmeri, $tmp_mini_virsmeraRinda); if ($this->MyPOST['is_vika'] == 'on') { $tmp_garums_pec_red = $tmp_garums_pec_red + $tmp_mini_virsmeraRinda; $tmp_nom_garums_pec_red = nominalGarums($tmp_garums_pec_red, $virsmeri, $tmp_mini_virsmeraRinda); $tilpums_neto = $this->calc_Volume($tmp_tievgalis_pec_red, $tmp_vidusdiametrs_pec_red, $tmp_resgalis_pec_red, $tmp_nom_garums_pec_red, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']); $tilpums_bruto_virsmeram = $this->calc_Volume($tmp_tievgalis_pirms_red, $tmp_vidusdiametrs_pirms_red, $tmp_resgalis_pirms_red, $tmp_nom_garums_pirms_red, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']); $tilpums_virsmers = ROUND($tilpums_bruto - $tilpums_bruto_virsmeram, 3); $tilpums_redukcija = $tilpums_bruto_virsmeram - $tilpums_neto; } else { $tilpums_neto = $this->calc_Volume($tmp_tievgalis_pec_red, $tmp_vidusdiametrs_pec_red, $tmp_resgalis_pec_red, $tmp_nom_garums_pec_red, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']); $tilpums_bruto_virsmeram = $this->calc_Volume($tmp_tievgalis_pirms_red, $tmp_vidusdiametrs_pirms_red, $tmp_resgalis_pirms_red, $tmp_nom_garums_pirms_red, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']); $tilpums_virsmers = ROUND($tilpums_bruto - $tilpums_bruto_virsmeram, 3); $tilpums_redukcija = $tilpums_bruto_virsmeram - $tilpums_neto; } if ($this->MyPOST['metode'] == 4) { if ($this->firmCode == 27) { $tilpums_bruto = floor($tmp_tilpumsBruto / 10) / 1000; $tilpums_neto = floor($tmp_tilpumsNeto / 10) / 1000; $tilpums_bruto_virsmeram = floor($tmp_tilpumsNeto / 10) / 1000; $tilpums_virsmers = $tilpums_bruto - $tilpums_bruto_virsmeram; $tilpums_redukcija = 0; } else { $tilpums_bruto = $tmp_tilpumsBruto; $tilpums_neto = $tmp_tilpumsNeto; $tilpums_bruto_virsmeram = $tmp_tilpumsNeto; $tilpums_virsmers = $tilpums_bruto - $tilpums_bruto_virsmeram; if ($this->firmCode == 26) { } $tilpums_redukcija = 0; } } $apmaksas_garums = $tmp_nom_garums_pec_red; if ($tilpums_virsmers < 0) { $tilpums_virsmers = 0; } if ($tilpums_bruto_virsmeram == 0) { $tilpums_virsmers = 0; } if ($tilpums_redukcija < 0) { $tilpums_redukcija = 0; } //-#003-FUNC-END-------------------------------------------------------------------------------------------------------------------------------------- //-#004-FUNC-START--Papildus dimensijas brāķa piešķiršana-------------------------------------------------------------------------------------------- $takeReCallOn4 = false; if ($tmp_nom_garums_pec_red < 1 && !$prnt_Brakis) { $prnt_Skira = 9; $prnt_Brakis = $this->braki['899']['LAT']; $takeReCallOn4 = true; } if (substr($prnt_Diametrs, 0, 1) == 'b' && !$prnt_Brakis) { $prnt_Skira = 9; $prnt_Brakis = $this->braki['899']['LAT']; $prnt_Diametrs = str_replace('b', '', $prnt_Diametrs); $takeReCallOn4 = true; } if (substr($prnt_Garums, 0, 1) == 'b' && !$prnt_Brakis) { $prnt_Skira = 9; $prnt_Brakis = $this->braki['899']['LAT']; $prnt_Garums = str_replace('b', '', $prnt_Garums); $takeReCallOn4 = true; } if ($prnt_Brakis == 'D') { // XML nobrāķēšana ar 4 kodu $takeReCallOn4 = true; } if ($this->firmCode == 26 && $tmp_getDataQuery_arr['brakis'] == '017' && $liguma_matrica == 'AC') { $tmp_is4 = mod_ResignLVMRejectCode($this->firmCode, $liguma_matrica, $tmp_getDataQuery_arr['garums'], $tmp_getDataQuery_arr['mind_pirms_red'], $tmp_getDataQuery_arr['suga'], $tmp_getDataQuery_arr['skira'], $tmp_getDataQuery_arr['brakis']); if ($tmp_is4) { $prnt_Brakis = $this->braki['702']['LAT']; } } if ($takeReCallOn4) { $tmp_is4 = mod_ResignLVMRejectCode($this->firmCode, $liguma_matrica, $tmp_getDataQuery_arr['garums'], $tmp_getDataQuery_arr['mind_pirms_red'], $tmp_getDataQuery_arr['suga'], $tmp_getDataQuery_arr['skira'], $tmp_getDataQuery_arr['brakis']); if ($tmp_is4) { $prnt_Brakis = $this->braki['856']['LAT']; } } if ($this->firmCode == 25) { if ($tmp_getDataQuery_arr['brakis'] == '003') { $prnt_Brakis = $this->braki['003']['LAT']; } } //-#004-FUNC-END----------------------------------------------------------------------------------------------------- //-#005-FUNC-START--Brāķa tilpuma aprēķināšana--------------------------------------------------------------------------------------------------- if ($prnt_Brakis) { $tilpums_neto = 0; $tilpums_redukcija = 0; if ($isBrakaVirsmOn == 'on') { if ($virsmeri_brakim) { $tmp_nom_garums_pirms_red_brakim = nominalGarums($tmp_getDataQuery_arr['garums'], $virsmeri_brakim, $tmp_mini_virsmeraRinda); $tilpums_bruto_virsmeram = $this->calc_Volume($tmp_tievgalis_pirms_red, $tmp_vidusdiametrs_pirms_red, $tmp_resgalis_pirms_red, $tmp_nom_garums_pirms_red_brakim, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']); $apmaksas_garums = $tmp_nom_garums_pirms_red_brakim; if ($tilpums_bruto_virsmeram > 0) { $tilpums_virsmers = $tilpums_bruto - $tilpums_bruto_virsmeram; $tilpums_brakis = $tilpums_bruto_virsmeram; $apmaksas_garums = $tmp_garums_pirms_red; } else { $tilpums_virsmers = 0; $tilpums_brakis = $tilpums_bruto; $apmaksas_garums = $tmp_garums_pirms_red; } } else { if ($tilpums_bruto_virsmeram > 0) { $tilpums_brakis = $tilpums_bruto_virsmeram; $apmaksas_garums = $tmp_nom_garums_pirms_red; } else { $tilpums_virsmers = 0; $tilpums_brakis = $tilpums_bruto; $apmaksas_garums = $tmp_garums_pirms_red; } } } else { $tilpums_virsmers = 0; $tilpums_brakis = $tilpums_bruto; $apmaksas_garums = $tmp_garums_pirms_red; } } $tmp_inputArrVal['mind_pirms_red'] = str_replace('b', '', $tmp_inputArrVal['mind_pirms_red']); $prnt_Diametrs = str_replace('b', '', $prnt_Diametrs); $tmp_inputArrVal['garums'] = str_replace('b', '', $tmp_inputArrVal['garums']); $prnt_Garums = str_replace('b', '', $prnt_Garums); //-#005-FUNC-END----------------------------------------------------------------------------------------------------- if ($this->genGlobalRegister_id > 0) { $datumsRegNow = date("Y-m-d H:i:s"); $subInsertRegisterBool = $this->regSubGlobalRegisters($datumsRegNow, $varDateTime, $this->genGlobalRegister_id, $this->tmp_pavadzimeInsert, $prnt_Suga, $prnt_Skira, $tmp_getDataQuery_arr['mind_pirms_red'], $prnt_Diametrs, $tmp_getDataQuery_arr['garums'], $prnt_Garums, $prnt_Brakis, $tilpums_bruto, $tilpums_brakis, $tilpums_neto); } //-#006-FUNC-START--Vienādo grupēšanu pāskats--------------------------------------------------------------------------------------------------- $pilnaGrupesana = false; if ($this->report_XML) { $pilnaGrupesana = true; } if (($this->firmCode == 16 || $this->firmCode == 666 || $this->isAllReport) && !$this->report_PDF) { $pilnaGrupesana = true; } $rowExist = 0; if (!$pilnaGrupesana) { for ($protoKey = $tmp_rowCount - 1; $protoKey > 0; $protoKey--) { if ($this->arrPrintOut[$protoKey]['suga'] == $prnt_Suga) { if ($this->arrPrintOut[$protoKey]['skira'] == $prnt_Skira) { if ($this->arrPrintOut[$protoKey]['diametrs'] == $prnt_Diametrs) { if ($this->arrPrintOut[$protoKey]['brakis_kods'] == $prnt_Brakis) { $rowExist = $protoKey; } } } } } } else { for ($protoKey = $tmp_rowCount - 1; $protoKey > 0; $protoKey--) { if ($this->arrPrintOut[$protoKey]['suga'] == $prnt_Suga) { if ($this->arrPrintOut[$protoKey]['skira'] == $prnt_Skira) { if ($this->arrPrintOut[$protoKey]['diametrs'] == $prnt_Diametrs) { if ($this->arrPrintOut[$protoKey]['garums'] == $prnt_Garums) { if ($this->arrPrintOut[$protoKey]['brakis_kods'] == $prnt_Brakis) { $rowExist = $protoKey; } } } } } } } //-#006-FUNC-END----------------------------------------------------------------------------------------------------- //-#007-FUNC-START--Statisko vērtību ievietošana--------------------------------------------------------------------------------------------------- $insertRow = $tmp_rowCount; if ($rowExist != 0) { $insertRow = $rowExist; } $this->arrPrintOut[$insertRow]['nosaukums'] = 0; $this->arrPrintOut[$insertRow]['suga'] = $prnt_Suga; $this->arrPrintOut[$insertRow]['skira'] = $prnt_Skira; $this->arrPrintOut[$insertRow]['diametrs'] = $prnt_Diametrs; $this->arrPrintOut[$insertRow]['garums'] = $prnt_Garums; $this->arrPrintOut[$insertRow]['brakis_kods'] = $prnt_Brakis; if ($this->report_XML) { $this->arrPrintOut[$insertRow]['diametrs_tmp'] = $tmp_getDataQuery_arr['mind_pirms_red']; // $this->arrPrintOut[$insertRow]['garums_tmp'] = $tmp_getDataQuery_arr['garums']; $this->arrPrintOut[$insertRow]['garums_tmp'] = $apmaksas_garums; } $this->arrPrintOut[$insertRow]['skaits'] += 1; if ($this->arrPrintOut[$insertRow]['brakis_kods'] != '') { $tilpums_skaits_brakis_KOPA += 1; } //-#007-FUNC-END----------------------------------------------------------------------------------------------------- //-#008-FUNC-START--Dinamisko vērtību piešķiršana--------------------------------------------------------------------------------------------------- $this->arrPrintOut[$insertRow]['bruto'] += $tilpums_bruto; $this->arrPrintOut[$insertRow]['virsmers'] += $tilpums_virsmers; $this->arrPrintOut[$insertRow]['redukcija'] += $tilpums_redukcija; $this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] += $tilpums_bruto - $tilpums_neto; $this->arrPrintOut[$insertRow]['brakis'] += $tilpums_brakis; $this->arrPrintOut[$insertRow]['neto'] += $tilpums_neto; $this->arrPrintOut[$insertRow]['brakis_un_neto'] += $tilpums_neto + $tilpums_brakis; //------------------------------------------------------------------------------------------------------ if ($this->arrPrintOut[$insertRow]['bruto'] != '') { $this->arrPrintOut[$insertRow]['bruto'] = number_format($this->arrPrintOut[$insertRow]['bruto'], 3, '.', ''); } else { $this->arrPrintOut[$insertRow]['bruto'] = ''; } if ($this->arrPrintOut[$insertRow]['virsmers'] != '') { $this->arrPrintOut[$insertRow]['virsmers'] = number_format($this->arrPrintOut[$insertRow]['virsmers'], 3, '.', ''); } else { $this->arrPrintOut[$insertRow]['virsmers'] = ''; } if ($this->arrPrintOut[$insertRow]['redukcija'] != '') { $this->arrPrintOut[$insertRow]['redukcija'] = number_format($this->arrPrintOut[$insertRow]['redukcija'], 3, '.', ''); } else { $this->arrPrintOut[$insertRow]['redukcija'] = ''; } if ($this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] != '') { $this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] = number_format($this->arrPrintOut[$insertRow]['redukcija_un_virsmers'], 3, '.', ''); } else { $this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] = ''; } if ($this->arrPrintOut[$insertRow]['brakis'] != '') { $this->arrPrintOut[$insertRow]['brakis'] = number_format($this->arrPrintOut[$insertRow]['brakis'], 3, '.', ''); } else { $this->arrPrintOut[$insertRow]['brakis'] = ''; } if ($this->arrPrintOut[$insertRow]['neto'] != '') { $this->arrPrintOut[$insertRow]['neto'] = number_format($this->arrPrintOut[$insertRow]['neto'], 3, '.', ''); } else { $this->arrPrintOut[$insertRow]['neto'] = ''; } if ($this->arrPrintOut[$insertRow]['brakis_un_neto'] != '') { $this->arrPrintOut[$insertRow]['brakis_un_neto'] = number_format($this->arrPrintOut[$insertRow]['brakis_un_neto'], 3, '.', ''); } else { $this->arrPrintOut[$insertRow]['brakis_un_neto'] = ''; } //------------------------------------------------------------------------------------------------------ $tilpums_bruto_KOPA = $tilpums_bruto_KOPA + $tilpums_bruto; $tilpums_virsmers_KOPA = $tilpums_virsmers_KOPA + $tilpums_virsmers; $tilpums_redukcija_KOPA = $tilpums_redukcija_KOPA + $tilpums_redukcija; $tilpums_neto_KOPA = $tilpums_neto_KOPA + $tilpums_neto; $tilpums_brakis_KOPA = $tilpums_brakis_KOPA + $tilpums_brakis; $tmp_balkuSkaits++; $tmp_rowCount++; } } else { while ($tmp_getDataQuery_arr = mysql_fetch_assoc($tmp_getDataQuery_query)) { $tilpums_bruto = 0; $tilpums_virsmers = 0; $tilpums_redukcija = 0; $tilpums_neto = 0; $tilpums_brakis = 0; $isBrakaVirsmOn = $this->MyPOST['braka_virsmers']; if ($tmp_getDataQuery_arr['pavadzime'] == 76806 && $this->firmCode == 2) { $isBrakaVirsmOn = 'off'; } //-#001-FUNC-START--Nepieciešamo datu kolekcionēšana no datubāzes------------------------------------------------------------------------------------ $tmp_ident_balkis = $tmp_getDataQuery_arr['id']; $var_Suga = $tmp_getDataQuery_arr['suga']; $tmp_tilpumsBruto = $tmp_getDataQuery_arr['tilpums']; $tmp_tilpumsNeto = $tmp_getDataQuery_arr['tilpums_scan']; $tmp_garums_pirms_red = $tmp_getDataQuery_arr['garums']; $tmp_garums_pec_red = $tmp_getDataQuery_arr['gar_pec_red']; $tmp_tievgalis_pirms_red = $tmp_getDataQuery_arr['mind_pirms_red']; $tmp_tievgalis_pec_red = $tmp_getDataQuery_arr['mind_pec_red']; $tmp_vidusdiametrs_pirms_red = $tmp_getDataQuery_arr['mind_miza']; $tmp_vidusdiametrs_pec_red = $tmp_getDataQuery_arr['mind_miza'] - ($tmp_getDataQuery_arr['mind_pirms_red'] - $tmp_getDataQuery_arr['mind_pec_red']); $tmp_resgalis_pirms_red = $tmp_getDataQuery_arr['maxd_miza']; $tmp_resgalis_pec_red = $tmp_getDataQuery_arr['maxd_miza'] - ($tmp_getDataQuery_arr['mind_pirms_red'] - $tmp_getDataQuery_arr['mind_pec_red']); //-#001-FUNC-END------------------------------------------------------------------------------------------------------------------------------------ //-#002-FUNC-START--Nepieciešamās grupas atrašana--------------------------------------------------------------------------------------------------- $igc = 1; // Grupu skaits $init_Group = false; while ($igc < 9 && $init_Group == false) { $tmp_igcCheck = 0; for ($igo = 1; $igo < 6; $igo++) { //Grupēšanas nosacījumus cikls for ($subcount = 0; $subcount < 3; $subcount++) { if ($this->tmpAllGroup[$igc][$this->GroupOrder[$igo]][$subcount]) { $tmp_SubResult = $this->tmpAllGroup[$igc][$this->GroupOrder[$igo]][$subcount]; if (!$this->tmpAllGroup[$igc][$this->GroupOrder[$igo]][0]) { $tmp_SubResult = $this->tmpAllGroup[$igc][$this->GroupOrder[$igo]][$var_Suga]; } $tmp_ALLbResult = $this->getMaskGroup($tmp_SubResult, $tmp_getDataQuery_arr[$this->GroupOrder[$igo]], $this->GroupOrder[$igo]); $tmp_inputArrVal[$this->GroupOrder[$igo]] = $tmp_ALLbResult; if ($tmp_ALLbResult != '') { $tmp_igcCheck = $tmp_igcCheck + 1; } } else { $tmp_igcCheck = $tmp_igcCheck + 1; } } if ($igo == 5 && $tmp_igcCheck == 15) { // Grupas noteikšana līdz pirmajiem sakritības rezultātiem (rekursija ar limitētu ciklu skaitu) $init_Group = true; $globalGroupIdent = $igc; } } $igc++; } //-#002-FUNC-END------------------------------------------------------------------------------------------------------------------------------------- //-#003-FUNC-START--Tilpuma aprēķināšana------------------------------------------------------------------------------------------------------------- $prnt_Nosaukums = 0; $prnt_Suga = $this->sugas[$var_Suga]['LAT']; $prnt_Skira = $tmp_getDataQuery_arr['skira']; $prnt_Brakis = $this->braki[$tmp_getDataQuery_arr['brakis']]['LAT']; $prnt_Diametrs = $tmp_inputArrVal['mind_pirms_red']; $prnt_Garums = $tmp_inputArrVal['garums']; //--------------------------------------------------------------------------------------------------------------------------------------------------- if ($this->firmCode == 35 && $prnt_Skira == 3) { $prnt_Skira = 9; $prnt_Brakis = $this->braki['010']['LAT']; } if ($this->firmCode == 37 && $prnt_Skira == 3) { $prnt_Skira = 9; $prnt_Brakis = $this->braki['011']['LAT']; } //--------------------------------------------------------------------------------------------------------------------------------------------------- if ($this->MyPOST['noapalot_garumu'] == '1') { $tmp_garums_pirms_red = floor($tmp_garums_pirms_red / 10) * 10; } elseif ($this->MyPOST['noapalot_garumu'] == '2') { $tmp_garums_pirms_red = (floor($tmp_garums_pirms_red / 10) + 0.5) * 10; } $tmp_raukumaRinda = $this->tmpRaukGroup[$globalGroupIdent][0]; if (!$tmp_raukumaRinda) { $tmp_raukumaRinda = $this->tmpRaukGroup[$globalGroupIdent][$var_Suga]; } $raukums = raukums_2_array($tmp_raukumaRinda); $rauk_koef = get_raukums_no_diam($raukums, $tmp_tievgalis_pirms_red); $tmp_DiamRedukcija = $tmp_tievgalis_pirms_red - $tmp_tievgalis_pec_red; $tilpums_bruto = $this->calc_Volume($tmp_tievgalis_pirms_red, $tmp_vidusdiametrs_pirms_red, $tmp_resgalis_pirms_red, $tmp_garums_pirms_red, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']); if ($this->MyPOST['noapalot_diametru'] == 'on') { $tmp_tievgalis_pec_red = (floor($tmp_tievgalis_pec_red / 10) + 0.5) * 100; } $tmp_virsmeraRinda = $this->tmpNomGarGroup[$globalGroupIdent][0]; if (!$tmp_virsmeraRinda) { $tmp_virsmeraRinda = $this->tmpNomGarGroup[$globalGroupIdent][$var_Suga]; } $tmp_virsmeraRindaBrakis = $this->tmpNomGarBrakGroup[$globalGroupIdent][0]; if (!$tmp_virsmeraRindaBrakis) { $tmp_virsmeraRindaBrakis = $this->tmpNomGarBrakGroup[$globalGroupIdent][$var_Suga]; } if ($tmp_virsmeraRindaBrakis) { $virsmeri_brakim = explode(',', $tmp_virsmeraRindaBrakis); for ($i = 0; $i < count($virsmeri_brakim); $i++) { $virsmeri_brakim[$i] = $virsmeri_brakim[$i]; } } $virsmeri = explode(',', $tmp_virsmeraRinda); for ($i = 0; $i < count($virsmeri); $i++) { $virsmeri[$i] = $virsmeri[$i]; } $tmp_mini_virsmeraRinda = $this->tmpVirsmGroup[$globalGroupIdent][0]; if (!$tmp_mini_virsmeraRinda) { $tmp_mini_virsmeraRinda = $this->tmpVirsmGroup[$globalGroupIdent][$var_Suga]; } $tmp_nom_garums_pirms_red = nominalGarums($tmp_getDataQuery_arr['garums'], $virsmeri, $tmp_mini_virsmeraRinda); $tmp_nom_garums_pec_red = nominalGarums($tmp_garums_pec_red, $virsmeri, $tmp_mini_virsmeraRinda); if ($this->MyPOST['is_vika'] == 'on') { $tmp_garums_pec_red = $tmp_garums_pec_red + $tmp_mini_virsmeraRinda; $tmp_nom_garums_pec_red = nominalGarums($tmp_garums_pec_red, $virsmeri, $tmp_mini_virsmeraRinda); $tilpums_neto = $this->calc_Volume($tmp_tievgalis_pec_red, $tmp_vidusdiametrs_pec_red, $tmp_resgalis_pec_red, $tmp_nom_garums_pec_red, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']); $tilpums_bruto_virsmeram = $this->calc_Volume($tmp_tievgalis_pirms_red, $tmp_vidusdiametrs_pirms_red, $tmp_resgalis_pirms_red, $tmp_nom_garums_pirms_red, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']); $tilpums_virsmers = ROUND($tilpums_bruto - $tilpums_bruto_virsmeram, 3); $tilpums_redukcija = $tilpums_bruto_virsmeram - $tilpums_neto; } else { $tilpums_neto = $this->calc_Volume($tmp_tievgalis_pec_red, $tmp_vidusdiametrs_pec_red, $tmp_resgalis_pec_red, $tmp_nom_garums_pec_red, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']); $tilpums_bruto_virsmeram = $this->calc_Volume($tmp_tievgalis_pirms_red, $tmp_vidusdiametrs_pirms_red, $tmp_resgalis_pirms_red, $tmp_nom_garums_pirms_red, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']); $tilpums_virsmers = ROUND($tilpums_bruto - $tilpums_bruto_virsmeram, 3); $tilpums_redukcija = $tilpums_bruto_virsmeram - $tilpums_neto; } if ($this->MyPOST['metode'] == 4) { if ($this->firmCode == 27) { $tilpums_bruto = floor($tmp_tilpumsBruto / 10) / 1000; $tilpums_neto = floor($tmp_tilpumsNeto / 10) / 1000; $tilpums_bruto_virsmeram = floor($tmp_tilpumsNeto / 10) / 1000; $tilpums_virsmers = $tilpums_bruto - $tilpums_bruto_virsmeram; $tilpums_redukcija = 0; } else { $tilpums_bruto = $tmp_tilpumsBruto; $tilpums_neto = $tmp_tilpumsNeto; $tilpums_bruto_virsmeram = $tmp_tilpumsNeto; $tilpums_virsmers = $tilpums_bruto - $tilpums_bruto_virsmeram; $tilpums_redukcija = 0; } } if ($tilpums_virsmers < 0) { $tilpums_virsmers = 0; } if ($tilpums_bruto_virsmeram == 0) { $tilpums_virsmers = 0; } if ($tilpums_redukcija < 0) { $tilpums_redukcija = 0; } //-#003-FUNC-END-------------------------------------------------------------------------------------------------------------------------------------- //-#004-FUNC-START--Papildus dimensijas brāķa priešķiršana-------------------------------------------------------------------------------------------- $takeReCallOn4 = false; if ($tmp_nom_garums_pec_red < 1 && !$prnt_Brakis) { $prnt_Skira = 9; $prnt_Brakis = $this->braki['899']['LAT']; $takeReCallOn4 = true; } if (substr($prnt_Diametrs, 0, 1) == 'b' && !$prnt_Brakis) { $prnt_Skira = 9; $prnt_Brakis = $this->braki['899']['LAT']; $prnt_Diametrs = str_replace('b', '', $prnt_Diametrs); $takeReCallOn4 = true; } if (substr($prnt_Garums, 0, 1) == 'b' && !$prnt_Brakis) { $prnt_Skira = 9; $prnt_Brakis = $this->braki['899']['LAT']; $prnt_Garums = str_replace('b', '', $prnt_Garums); $takeReCallOn4 = true; } if ($this->firmCode == 26 && $tmp_getDataQuery_arr['brakis'] == '017' && $liguma_matrica == 'AC') { $tmp_is4 = mod_ResignLVMRejectCode($this->firmCode, $liguma_matrica, $tmp_getDataQuery_arr['garums'], $tmp_getDataQuery_arr['mind_pirms_red'], $tmp_getDataQuery_arr['suga'], $tmp_getDataQuery_arr['skira'], $tmp_getDataQuery_arr['brakis']); if ($tmp_is4) { $prnt_Brakis = $this->braki['702']['LAT']; } } if ($prnt_Brakis == 'D') { // XML nobrāķēšana ar 4 kodu $takeReCallOn4 = true; } if ($takeReCallOn4) { $tmp_is4 = mod_ResignLVMRejectCode($this->firmCode, $liguma_matrica, $tmp_getDataQuery_arr['garums'], $tmp_getDataQuery_arr['mind_pirms_red'], $tmp_getDataQuery_arr['suga'], $tmp_getDataQuery_arr['skira'], $tmp_getDataQuery_arr['brakis']); if ($tmp_is4) { $prnt_Brakis = $this->braki['856']['LAT']; } } //-#004-FUNC-END----------------------------------------------------------------------------------------------------- //-#005-FUNC-START--Brāķa tilpuma aprēķināšana--------------------------------------------------------------------------------------------------- if ($prnt_Brakis) { $tilpums_neto = 0; $tilpums_redukcija = 0; if ($isBrakaVirsmOn == 'on') { if ($virsmeri_brakim) { $tmp_nom_garums_pirms_red_brakim = nominalGarums($tmp_getDataQuery_arr['garums'], $virsmeri_brakim, $tmp_mini_virsmeraRinda); $tilpums_bruto_virsmeram = $this->calc_Volume($tmp_tievgalis_pirms_red, $tmp_vidusdiametrs_pirms_red, $tmp_resgalis_pirms_red, $tmp_nom_garums_pirms_red_brakim, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']); if ($tilpums_bruto_virsmeram > 0) { $tilpums_virsmers = $tilpums_bruto - $tilpums_bruto_virsmeram; $tilpums_brakis = $tilpums_bruto_virsmeram; } else { $tilpums_virsmers = 0; $tilpums_brakis = $tilpums_bruto; } } else { if ($tilpums_bruto_virsmeram > 0) { $tilpums_brakis = $tilpums_bruto_virsmeram; } else { $tilpums_virsmers = 0; $tilpums_brakis = $tilpums_bruto; } } } else { $tilpums_virsmers = 0; $tilpums_brakis = $tilpums_bruto; } } $tmp_inputArrVal['mind_pirms_red'] = str_replace('b', '', $tmp_inputArrVal['mind_pirms_red']); $prnt_Diametrs = str_replace('b', '', $prnt_Diametrs); $tmp_inputArrVal['garums'] = str_replace('b', '', $tmp_inputArrVal['garums']); $prnt_Garums = str_replace('b', '', $prnt_Garums); //-#005-FUNC-END----------------------------------------------------------------------------------------------------- //-#006-FUNC-START--Vienādo grupēšanu pāskats--------------------------------------------------------------------------------------------------- $pilnaGrupesana = false; if ($this->report_XML) { $pilnaGrupesana = true; } if (($this->firmCode == 16 || $this->firmCode == 666 || $this->isAllReport) && !$this->report_PDF) { $pilnaGrupesana = true; } //-#006-FUNC-END----------------------------------------------------------------------------------------------------- //-#007-FUNC-START--Statisko vērtību ievietošana--------------------------------------------------------------------------------------------------- /* $insertRow = $tmp_rowCount; if($rowExist != 0){$insertRow = $rowExist;} $this->arrPrintOut[$insertRow]['nosaukums'] = 0; $this->arrPrintOut[$insertRow]['suga'] = $prnt_Suga; $this->arrPrintOut[$insertRow]['skira'] = $prnt_Skira; $this->arrPrintOut[$insertRow]['diametrs'] = $prnt_Diametrs; $this->arrPrintOut[$insertRow]['garums'] = $prnt_Garums; $this->arrPrintOut[$insertRow]['brakis_kods'] = $prnt_Brakis; if($this->report_XML){ $this->arrPrintOut[$insertRow]['diametrs_tmp'] = $tmp_getDataQuery_arr['mind_pirms_red']; $this->arrPrintOut[$insertRow]['garums_tmp'] = $tmp_getDataQuery_arr['garums']; } $this->arrPrintOut[$insertRow]['skaits'] += 1; if($this->arrPrintOut[$insertRow]['brakis_kods'] != ''){ $tilpums_skaits_brakis_KOPA += 1; } */ $tmp_skaits = 1; $querySub_text = "INSERT INTO `global_kops_atsk` (`group_suga`,`group_skira`,`group_diametrs`,`group_garums`,`group_brakis`,`group_tilp_neto`,`group_tilp_bruto`,`group_tilp_brakis`,`group_tilp_neto_un_brakis`,`group_tilp_redukcija`,`group_tilp_virsmers`,`group_skaits`) VALUES ('{$prnt_Suga}','{$prnt_Skira}','{$prnt_Diametrs}','{$prnt_Garums}','{$prnt_Brakis}',{$tilpums_neto},{$tilpums_bruto},{$tilpums_brakis},{$tilpums_neto} + {$tilpums_brakis},{$tilpums_redukcija},{$tilpums_virsmers},{$tmp_skaits})"; mysql_query($querySub_text); //-#007-FUNC-END----------------------------------------------------------------------------------------------------- /* //-#008-FUNC-START--Dinamisko vērtību piešķiršana--------------------------------------------------------------------------------------------------- $this->arrPrintOut[$insertRow]['bruto'] += $tilpums_bruto; $this->arrPrintOut[$insertRow]['virsmers'] += $tilpums_virsmers; $this->arrPrintOut[$insertRow]['redukcija'] += $tilpums_redukcija; $this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] += $tilpums_bruto - $tilpums_neto; $this->arrPrintOut[$insertRow]['brakis'] += $tilpums_brakis; $this->arrPrintOut[$insertRow]['neto'] += $tilpums_neto; $this->arrPrintOut[$insertRow]['brakis_un_neto'] += $tilpums_neto + $tilpums_brakis; //------------------------------------------------------------------------------------------------------ if($this->arrPrintOut[$insertRow]['bruto'] != ''){$this->arrPrintOut[$insertRow]['bruto'] = number_format($this->arrPrintOut[$insertRow]['bruto'], 3, '.', '');}else{$this->arrPrintOut[$insertRow]['bruto'] = '';} if($this->arrPrintOut[$insertRow]['virsmers'] != ''){$this->arrPrintOut[$insertRow]['virsmers'] = number_format($this->arrPrintOut[$insertRow]['virsmers'], 3, '.', '');}else{$this->arrPrintOut[$insertRow]['virsmers'] = '';} if($this->arrPrintOut[$insertRow]['redukcija'] != ''){$this->arrPrintOut[$insertRow]['redukcija'] = number_format($this->arrPrintOut[$insertRow]['redukcija'], 3, '.', '');}else{$this->arrPrintOut[$insertRow]['redukcija'] = '';} if($this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] != ''){$this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] = number_format($this->arrPrintOut[$insertRow]['redukcija_un_virsmers'], 3, '.', '');}else{$this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] = '';} if($this->arrPrintOut[$insertRow]['brakis'] != ''){$this->arrPrintOut[$insertRow]['brakis'] = number_format($this->arrPrintOut[$insertRow]['brakis'], 3, '.', '');}else{$this->arrPrintOut[$insertRow]['brakis'] = '';} if($this->arrPrintOut[$insertRow]['neto'] != ''){$this->arrPrintOut[$insertRow]['neto'] = number_format($this->arrPrintOut[$insertRow]['neto'], 3, '.', '');}else{$this->arrPrintOut[$insertRow]['neto'] = '';} if($this->arrPrintOut[$insertRow]['brakis_un_neto'] != ''){$this->arrPrintOut[$insertRow]['brakis_un_neto'] = number_format($this->arrPrintOut[$insertRow]['brakis_un_neto'], 3, '.', '');}else{$this->arrPrintOut[$insertRow]['brakis_un_neto'] = '';} //------------------------------------------------------------------------------------------------------ $tilpums_bruto_KOPA = $tilpums_bruto_KOPA + $tilpums_bruto; $tilpums_virsmers_KOPA = $tilpums_virsmers_KOPA + $tilpums_virsmers; $tilpums_redukcija_KOPA = $tilpums_redukcija_KOPA + $tilpums_redukcija; $tilpums_neto_KOPA = $tilpums_neto_KOPA + $tilpums_neto; $tilpums_brakis_KOPA = $tilpums_brakis_KOPA + $tilpums_brakis; $tmp_balkuSkaits++; $tmp_rowCount++; */ } $mysqlGlobalSelect_text = "SELECT `group_suga`, `group_skira`, `group_diametrs`, `group_garums`, `group_brakis`, SUM(`group_skaits`) as skaits, SUM(`group_tilp_bruto`) as bruto, SUM(`group_tilp_virsmers`) as virsmers, SUM(`group_tilp_redukcija`) as redukcija, SUM(`group_tilp_brakis`) as brakis_tilp, SUM(`group_tilp_neto`) as neto FROM `global_kops_atsk` GROUP BY `group_suga`, `group_skira`, `group_diametrs`, `group_garums`, `group_brakis` ORDER BY `group_suga`, `group_skira`, `group_diametrs`, `group_garums`, `group_brakis`"; // echo $mysqlGlobalSelect_text.'<br />'; $mysqlGlobalSelect = mysql_query($mysqlGlobalSelect_text); $insertRow = $tmp_rowCount; while ($mysqlGlobalSelect_arr = mysql_fetch_assoc($mysqlGlobalSelect)) { $this->arrPrintOut[$insertRow]['nosaukums'] = 0; $this->arrPrintOut[$insertRow]['suga'] = $mysqlGlobalSelect_arr['group_suga']; $this->arrPrintOut[$insertRow]['skira'] = $mysqlGlobalSelect_arr['group_skira']; $this->arrPrintOut[$insertRow]['diametrs'] = $mysqlGlobalSelect_arr['group_diametrs']; $this->arrPrintOut[$insertRow]['garums'] = $mysqlGlobalSelect_arr['group_garums']; $this->arrPrintOut[$insertRow]['brakis_kods'] = $mysqlGlobalSelect_arr['group_brakis']; $this->arrPrintOut[$insertRow]['skaits'] = $mysqlGlobalSelect_arr['skaits']; $this->arrPrintOut[$insertRow]['bruto'] = $mysqlGlobalSelect_arr['bruto']; $this->arrPrintOut[$insertRow]['virsmers'] = $mysqlGlobalSelect_arr['virsmers']; $this->arrPrintOut[$insertRow]['redukcija'] = $mysqlGlobalSelect_arr['redukcija']; $this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] = $mysqlGlobalSelect_arr['redukcija'] + $mysqlGlobalSelect_arr['virsmers']; $this->arrPrintOut[$insertRow]['brakis'] = $mysqlGlobalSelect_arr['brakis_tilp']; $this->arrPrintOut[$insertRow]['neto'] = $mysqlGlobalSelect_arr['neto']; $this->arrPrintOut[$insertRow]['brakis_un_neto'] = $mysqlGlobalSelect_arr['brakis'] + $mysqlGlobalSelect_arr['neto']; if ($this->arrPrintOut[$insertRow]['bruto'] != '' && $this->arrPrintOut[$insertRow]['bruto'] != 0) { $this->arrPrintOut[$insertRow]['bruto'] = number_format($this->arrPrintOut[$insertRow]['bruto'], 3, '.', ''); } else { $this->arrPrintOut[$insertRow]['bruto'] = ''; } if ($this->arrPrintOut[$insertRow]['virsmers'] != '' && $this->arrPrintOut[$insertRow]['virsmers'] != 0) { $this->arrPrintOut[$insertRow]['virsmers'] = number_format($this->arrPrintOut[$insertRow]['virsmers'], 3, '.', ''); } else { $this->arrPrintOut[$insertRow]['virsmers'] = ''; } if ($this->arrPrintOut[$insertRow]['redukcija'] != '' && $this->arrPrintOut[$insertRow]['redukcija'] != 0) { $this->arrPrintOut[$insertRow]['redukcija'] = number_format($this->arrPrintOut[$insertRow]['redukcija'], 3, '.', ''); } else { $this->arrPrintOut[$insertRow]['redukcija'] = ''; } if ($this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] != '' && $this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] != 0) { $this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] = number_format($this->arrPrintOut[$insertRow]['redukcija_un_virsmers'], 3, '.', ''); } else { $this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] = ''; } if ($this->arrPrintOut[$insertRow]['brakis'] != '' && $this->arrPrintOut[$insertRow]['brakis'] != 0) { $this->arrPrintOut[$insertRow]['brakis'] = number_format($this->arrPrintOut[$insertRow]['brakis'], 3, '.', ''); } else { $this->arrPrintOut[$insertRow]['brakis'] = ''; } if ($this->arrPrintOut[$insertRow]['neto'] != '' && $this->arrPrintOut[$insertRow]['neto'] != 0) { $this->arrPrintOut[$insertRow]['neto'] = number_format($this->arrPrintOut[$insertRow]['neto'], 3, '.', ''); } else { $this->arrPrintOut[$insertRow]['neto'] = ''; } if ($this->arrPrintOut[$insertRow]['brakis_un_neto'] != '' && $this->arrPrintOut[$insertRow]['brakis_un_neto'] != 0) { $this->arrPrintOut[$insertRow]['brakis_un_neto'] = number_format($this->arrPrintOut[$insertRow]['brakis_un_neto'], 3, '.', ''); } else { $this->arrPrintOut[$insertRow]['brakis_un_neto'] = ''; } $tilpums_bruto_KOPA = $tilpums_bruto_KOPA + $mysqlGlobalSelect_arr['bruto']; $tilpums_virsmers_KOPA = $tilpums_virsmers_KOPA + $mysqlGlobalSelect_arr['virsmers']; $tilpums_redukcija_KOPA = $tilpums_redukcija_KOPA + $mysqlGlobalSelect_arr['redukcija']; $tilpums_neto_KOPA = $tilpums_neto_KOPA + $mysqlGlobalSelect_arr['neto']; $tilpums_brakis_KOPA = $tilpums_brakis_KOPA + $mysqlGlobalSelect_arr['brakis_tilp']; $tmp_balkuSkaits = $tmp_balkuSkaits + $mysqlGlobalSelect_arr['skaits']; $tmp_rowCount++; $insertRow++; } } // } //-#008-FUNC-END----------------------------------------------------------------------------------------------------- //-#009-FUNC-START--Rindu pārgrupēšana masīvā--------------------------------------------------------------------------------------------------- if (($this->firmCode == 16 || $this->firmCode == 20 || $bbq_temp == true || $this->isAllReport) && !$this->report_PDF && !$this->report_XML) { $this->arrPrintOut = array_orderby($this->arrPrintOut, 'suga', SORT_ASC, 'skira', SORT_ASC, 'diametrs', SORT_ASC, 'garums', SORT_ASC, 'brakis_kods', SORT_ASC); } else { $this->arrPrintOut = array_orderby($this->arrPrintOut, 'suga', SORT_ASC, 'skira', SORT_ASC, 'diametrs', SORT_ASC, 'brakis_kods', SORT_ASC); } array_unshift($this->arrPrintOut, $tmp_arrCollName); //-#009-FUNC-END----------------------------------------------------------------------------------------------------- //-#010-FUNC-START--Kopsummas rindas pievienošana--------------------------------------------------------------------------------------------------- $this->arrPrintOut[$tmp_rowCount]['nosaukums'] = 1; $this->arrPrintOut[$tmp_rowCount]['suga'] = ""; $this->arrPrintOut[$tmp_rowCount]['skira'] = ""; $this->arrPrintOut[$tmp_rowCount]['diametrs'] = ""; $this->arrPrintOut[$tmp_rowCount]['garums'] = ""; $this->arrPrintOut[$tmp_rowCount]['brakis_kods'] = ""; $this->arrPrintOut[$tmp_rowCount]['skaits'] = $tmp_balkuSkaits; $this->arrPrintOut[$tmp_rowCount]['bruto'] = number_format($tilpums_bruto_KOPA, 3, '.', '') . "*"; $this->arrPrintOut[$tmp_rowCount]['virsmers'] = number_format($tilpums_virsmers_KOPA, 3, '.', '') . "*"; $this->arrPrintOut[$tmp_rowCount]['redukcija'] = number_format($tilpums_redukcija_KOPA, 3, '.', '') . "*"; $this->arrPrintOut[$tmp_rowCount]['redukcija_un_virsmers'] = number_format($tilpums_bruto_KOPA - $tilpums_neto_KOPA, 3, '.', '') . "*"; $this->arrPrintOut[$tmp_rowCount]['brakis'] = number_format($tilpums_brakis_KOPA, 3, '.', '') . "*"; $this->arrPrintOut[$tmp_rowCount]['neto'] = number_format($tilpums_neto_KOPA, 3, '.', '') . "*"; $this->arrPrintOut[$tmp_rowCount]['brakis_un_neto'] = number_format($tilpums_brakis_KOPA + $tilpums_neto_KOPA, 3, '.', '') . "*"; $this->regSuperSum['bruto'] = $tilpums_bruto_KOPA; $this->regSuperSum['virsmers'] = $tilpums_virsmers_KOPA; $this->regSuperSum['redukcija'] = $tilpums_redukcija_KOPA; $this->regSuperSum['brakis'] = $tilpums_brakis_KOPA; $this->regSuperSum['neto'] = $tilpums_neto_KOPA; $this->regSuperSum['skaits'] = $tmp_balkuSkaits; $this->regSuperSum['skaits_brakis'] = $tilpums_skaits_brakis_KOPA; //-#010-FUNC-END----------------------------------------------------------------------------------------------------- //-#011-FUNC-START-END-Rezultāts--------------------------------------------------------------------------------------------------- // fb($this->arrPrintOut,'arrPrintOut'); // break; return true; }
function print_level($query, &$summa_p, $irbrakis_p, $suga, $id) { global $lang; global $translate; $select = ""; $orderby = "ORDER BY "; $criteria = array(); for ($level = 1; $level <= $this->lsk; $level++) { // tekošā grupēšanas līmeņa lauks $lauks = $this->MyPOST["gtype" . $this->grup . $level]; if ($lauks == 'garums' || $lauks == 'mind_pirms_red') { $this->build_value_ranges($level, $suga); if ($lauks == 'garums') { $this->gar_allowed_values = $this->allowed_values; } elseif ($lauks == 'mind_pirms_red') { $this->diam_allowed_values = $this->allowed_values; } } if ($lauks == 'fsc') { $this->allowed_values = array(); $this->allowed_values[0] = '0'; $this->allowed_values[1] = '1'; $typ = 'string'; } if ($lauks == 'kad_piegad' || $lauks == 'auto' || $lauks == 'brakis' || $lauks == 'cenu_matrica' || $lauks == 'cirsmas_kods' || $lauks == 'kad_piegad' || $lauks == 'kravas_id' || $lauks == 'pavadzime.pavadzime' || $lauks == 'piegad_kods' || $lauks == 'soferis' || $lauks == 'skira' || $lauks == 'suga' || $lauks == 'iecirknis') { //no visiem atlas?tajiem ba??iem pavadz?m? atlasa attiec?g? lauka atrodam?s v?rt?bas (pa vienai) $this->build_single_values($lauks, $query); } $row = 0; $summa_p->init(); $myid = 0; while (list($key, $val) = each($this->allowed_values)) { $myid++; if ($lauks == 'suga') { $suga = $val; } // virsm?ru sadal?jums if ($suga && $this->MyPOST['dalit_virsmeri' . $this->grup]) { if ($this->MyPOST['virsmeri' . $this->grup . '_' . $suga] != '') { $virsmeri = explode(',', $this->MyPOST['virsmeri' . $this->grup . '_' . $suga]); for ($i = 0; $i < count($virsmeri); $i++) { $virsmeri[$i] = $virsmeri[$i] / 100; } } } else { if ($this->MyPOST['virsmeri' . $this->grup] != '') { $virsmeri = explode(',', $this->MyPOST['virsmeri' . $this->grup]); for ($i = 0; $i < count($virsmeri); $i++) { $virsmeri[$i] = $virsmeri[$i] / 100; } } } if ($suga && $this->MyPOST['dalit_raukums' . $this->grup]) { $raukums = raukums_2_array($this->MyPOST['raukums' . $this->grup . '_' . $suga]); } else { $raukums = raukums_2_array($this->MyPOST['raukums' . $this->grup]); } if ($suga && $this->MyPOST['dalit_koeficients' . $this->grup]) { $koeficients = $this->MyPOST['koeficients' . $this->grup . '_' . $suga]; } else { $koeficients = $this->MyPOST['koeficients' . $this->grup]; } if ($typ != 'string') { $mbounds = explode('-', $this->allowed_values[$key]); } if (count($mbounds) > 1) { $low_range_brakis = 0; $high_range_brakis = 0; if ($mbounds[0] > 5) { $low_range_brakis = $mbounds[0] + 5; } else { $low_range_brakis = $mbounds[0]; } if ($mbounds[1] < 994) { $high_range_brakis = $mbounds[1] + 5; } else { $high_range_brakis = $mbounds[1]; } //pievienots 17.07.2007 if ($myid == 1) { $select .= ", CASE \n"; } if ($this->MyPOST["gtype" . $this->grup . $level] == 'mind_pirms_red') { $select .= "WHEN ((balkis_temp.import_type <> 'zbm' AND mind_pirms_red BETWEEN {$mbounds['0']} AND {$mbounds['1']}) OR (balkis_temp.import_type = 'zbm' AND mind_pirms_red BETWEEN {$low_range_brakis} AND {$high_range_brakis})) THEN {$myid} \n"; if ($myid == sizeof($this->allowed_values)) { $select .= "END AS diam_group"; $orderby .= "diam_group"; $criteria[] = "diam_group"; // } //$myquery = $query . " and ((". $this->MyPOST["gtype".$this->grup.$level] . ">=" . $mbounds[0] ." and " . $this->MyPOST["gtype".$this->grup.$level] . "<=" . $mbounds[1] . " AND balkis_temp.import_type <> 'zbm') or (". $this->MyPOST["gtype".$this->grup.$level] . ">=" . $low_range_brakis ." and " . $this->MyPOST["gtype".$this->grup.$level] . "<=" . $high_range_brakis . " AND balkis_temp.import_type = 'zbm'))"; } else { $select .= "WHEN (garums BETWEEN {$mbounds['0']} AND {$mbounds['1']}) THEN {$myid} \n"; if ($myid == sizeof($this->allowed_values)) { $select .= "END AS gar_group"; $orderby .= "gar_group"; $criteria[] = "gar_group"; //$this->gar_allowed_values = $this->allowed_values; } //$myquery = $query . " and (". $this->MyPOST["gtype".$this->grup.$level] . ">=" . $mbounds[0] ." and " . $this->MyPOST["gtype".$this->grup.$level] . "<=" . $mbounds[1] . ")"; } } else { if ($myid == sizeof($this->allowed_values)) { $orderby .= $this->MyPOST["gtype" . $this->grup . $level]; $criteria[] = $this->MyPOST["gtype" . $this->grup . $level]; } } if ($myid == sizeof($this->allowed_values) && $level < $this->lsk) { $orderby .= ","; } } } $query__ = "select mind_pirms_red as DBruto, garums as LBruto, mind_pec_red as DPecReduc, gar_pec_red as LPecReduc, brakis, suga, pavadzime.cenu_matrica as cm" . $select . $query . $orderby; $r = mysql_query($query__); $same_group = false; $gostu_tabula = $this->MyPOST['gostu_tabula' . $this->grup]; while ($m = mysql_fetch_array($r)) { $last = $m; $same_group = true; $criteria_changed = 6; for ($ci = $this->lsk - 1; $ci >= 0; $ci--) { $value = $criteria[$ci]; if ($old_values[$value] != $m[$value]) { $criteria_changed = $ci; } if ($old_values[$value] != $m[$value]) { if ($same_group) { $old_bak = $old_values; } $same_group = false; $old_values[$value] = $m[$value]; } } if (!$same_group && $old_bak) { for ($ci = $this->lsk - 2; $ci >= 0; $ci--) { if (!$summa[$ci + 1]) { $summa[$ci + 1] = new CSumma(); } $summa[$ci + 1]->add_skaits($SSkaits); $summa[$ci + 1]->add_skaits_bad($SSkaitsBad); $summa[$ci + 1]->add_virsmers($SVVirsm); $summa[$ci + 1]->add_redukcija_d($SVReducD); $summa[$ci + 1]->add_redukcija_l($SVReducL); $summa[$ci + 1]->add_brakis($SVBrakis); $summa[$ci + 1]->add_neto($SVNeto); $summa[$ci + 1]->add_bruto($SVBruto); if ($criteria_changed <= $ci && !$this->XML_Variants) { //fb($summa,'Summa'); $this->AddSumRowAtLevel($ci, $criteria, $summa, $old_bak); } } $this->arr_index++; $this->arr[$this->arr_index] = array(); foreach ($criteria as $key => $value) { $this->arr[$this->arr_index][$key] = $this->kodi($value, $old_bak[$value]); } $sm = new CSumma(); $sm->skaits = $SSkaits; $sm->skaits_bad = $SSkaitsBad; $sm->virsmers = $SVVirsm; $sm->redukcija_d = $SVReducD; $sm->redukcija_l = $SVReducL; $sm->brakis = $SVBrakis; $sm->neto = $SVNeto; $sm->bruto = $SVBruto; //fb($sm,'Sm'); $this->arr[$this->arr_index][summa] = $sm; //echo $m['brakis']; $summa_p->add_skaits($SSkaits); $summa_p->add_skaits_bad($SSkaitsBad); $summa_p->add_virsmers($SVVirsm); $summa_p->add_redukcija_d($SVReducD); $summa_p->add_redukcija_l($SVReducL); $summa_p->add_brakis($SVBrakis); $summa_p->add_neto($SVNeto); $summa_p->add_bruto($SVBruto); /*NULL vertibu ievietosana*/ $SVBruto = 0; $SVReducD = 0; $SVReducL = 0; $SVVirsm = 0; $SVNeto = 0; $SVBrakis = 0; $SSkaits = 0; $SSkaitsBad = 0; } $SSkaits++; /*Vai ir Vika Wood*/ // $min_virsmers = 0; if ($suga && $this->MyPOST['dalit_virsmers' . $this->grup]) { $min_virsmers = $this->MyPOST['virsmers' . $this->grup . '_' . $suga] / 100; } else { $min_virsmers = $this->MyPOST['virsmers' . $this->grup] / 100; } if ($this->MyPOST['metode'] == '1') { } else { if ($this->MyPOST['metode'] == '2') { } else { if ($this->MyPOST['metode'] == '3') { } else { if ($this->MyPOST['metode'] == '4') { } else { } } } } $tilp_Metode = $this->MyPOST['metode']; $gar_PirmsRed = 0; $gar_PecRed = 0; $diam_TievPirmsRed = 0; $diam_TievPecRed = 0; $diam_VidusPirmsRed = 0; $diam_VidusPecRed = 0; $diam_ResPirmsRed = 0; $diam_ResPecRed = 0; //---Tiek veikta pārbaude, pēc kādiem nosacījumiem noapaļot garumu pirms redukcijas, no kura tiek rēķināts Bruto tilpums!------------------------------------------------------------------------- $gar_PirmsRed = $m['LBruto'] / 100; if ($this->MyPOST['noapalot_garumu'] == '1') { $gar_PirmsRed = floor($m['LBruto'] / 10) / 10; } elseif ($this->MyPOST['noapalot_garumu'] == '2') { $gar_PirmsRed = (floor($m['LBruto'] / 10) + 0.5) / 10; } //---Tiek pārbaudīts, vai garums tiek ņemts kā nominālais garums, vai notiek nominālā garuma aprēķināšana, no kura tiks rēķināts Neto tilpums!------------------------------------------------------------------------- $gar_PecRed = gAtskaite::nom($gar_PirmsRed, $virsmeri, $min_virsmers); if ($this->MyPOST['is_vika'] == 'on') { $gar_PecRed = $m['LPecReduc'] / 100; } //---Tiek aprēķināts nominālais garums pirms pirms redukcijas, lai varētu aprēķināt tilpumu bez virsmēra!------------------------------------------------------------------------- $gar_NomPirsmRed = gAtskaite::nom($gar_PirmsRed, $virsmeri, $min_virsmers); //---------------------------------------------------------------------------- $diam_TievPirmsRed = $m['DBruto'] / 1000; $diam_VidusPirmsRed = $m['DBruto'] / 1000; $diam_ResPirmsRed = $m['DBruto'] / 1000; $rauk_koef = get_raukums_no_diam($raukums, $diam_TievPirmsRed * 1000); if ($this->MyPOST['noapalot_diametru'] == 'on') { $diam_TievPirmsRed = (floor($m['DBruto'] / 10) + 0.5) / 100; $diam_VidusPirmsRed = (floor($m['DBruto'] / 10) + 0.5) / 100; $diam_ResPirmsRed = (floor($m['DBruto'] / 10) + 0.5) / 100; } //---------------------------------------------------------------------------- if ($this->MyPOST['braka_virsmers'] == 'on') { } else { } $DPecReduc = $m['DPecReduc'] / 1000; $DReduc = $DBruto - $DPecReduc; if ($m[brakis] != '255') { $irbrakis = true; $brkods = 'standart'; } $tilpums_bruto = f2($diam_TievPirmsRed, $gar_PirmsRed, $rauk_koef, $koeficients, $gostu_tabula); $tilpums_neto = f2($DPecReduc, $gar_PecRed, $rauk_koef, $koeficients, $gostu_tabula); $tilpums_bruto_bez_virsmera = f2($diam_TievPirmsRed, $gar_NomPirsmRed, $rauk_koef, $koeficients, $gostu_tabula); $tilpums_virsmers = $tilpums_bruto - $tilpums_bruto_bez_virsmera; $tilpums_garuma_redukcija = $tilpums_bruto_bez_virsmera - $tilpums_neto; $tilpums_diametrs_redukcija = 0; //---------- $SVBruto += $tilpums_bruto; if ($gostu_tabula) { if ($VBruto == -1 || $VReducD == -1 || $VReducL == -1 || $VVirsm == -1) { $SSkaitsBad++; } if ($VBruto == -1) { $VBruto = 0; } if ($VReducD == -1) { $VReducD = 0; } if ($VReducL == -1) { $VReducL = 0; } if ($VVirsm == -1) { $VVirsm = 0; } } $VBrakis = 0; if (strlen($this->rejected_values[$key]) == 1) { $irbrakis = true; $brkods = $this->rejected_values[$key]; } if (!$irbrakis) { /*Vai ir brakis?*/ $SVReducD += $tilpums_diametrs_redukcija; $SVReducL += $tilpums_garuma_redukcija; if ($gar_PecRed != 0) { $SVVirsm += $tilpums_virsmers; $SVNeto += $tilpums_neto; } else { $SVBrakis += $SVBruto; } } else { if ($gar_PecRed != 0) { $SVVirsm += $tilpums_virsmers; $VBrakis = $tilpums_bruto - $tilpums_virsmers; $SVBrakis += $VBrakis; } else { $VBrakis = $tilpums_bruto; $SVBrakis += $VBrakis; } } } /*Ievietosana*/ //$this->arr[$this->arr_index][$level-1] = $this->kodi($this->MyPOST['gtype'.$this->grup.$this->lsk],$val); /* Vienu reizi pašās beigās papildina ar pēdējo ierakstu */ $this->arr_index++; $this->arr[$this->arr_index] = array(); foreach ($criteria as $key => $value) { //fb($m['value']); $this->arr[$this->arr_index][$key] = $this->kodi($value, $last[$value]); } $sm = new CSumma(); $sm->skaits = $SSkaits; $sm->skaits_bad = $SSkaitsBad; $sm->virsmers = $SVVirsm; $sm->redukcija_d = $SVReducD; $sm->redukcija_l = $SVReducL; $sm->brakis = $SVBrakis; $sm->neto = $SVNeto; $sm->bruto = $SVBruto; $this->arr[$this->arr_index][summa] = $sm; for ($ci = $this->lsk - 2; $ci >= 0; $ci--) { if (!$summa[$ci + 1]) { $summa[$ci + 1] = new CSumma(); } $summa[$ci + 1]->add_skaits($SSkaits); $summa[$ci + 1]->add_skaits_bad($SSkaitsBad); $summa[$ci + 1]->add_virsmers($SVVirsm); $summa[$ci + 1]->add_redukcija_d($SVReducD); $summa[$ci + 1]->add_redukcija_l($SVReducL); $summa[$ci + 1]->add_brakis($SVBrakis); $summa[$ci + 1]->add_neto($SVNeto); $summa[$ci + 1]->add_bruto($SVBruto); if (!$this->XML_Variants) { $this->AddSumRowAtLevel($ci, $criteria, $summa, $last); } } $summa_p->add_skaits($SSkaits); $summa_p->add_skaits_bad($SSkaitsBad); $summa_p->add_virsmers($SVVirsm); $summa_p->add_redukcija_d($SVReducD); $summa_p->add_redukcija_l($SVReducL); $summa_p->add_brakis($SVBrakis); $summa_p->add_neto($SVNeto); $summa_p->add_bruto($SVBruto); }