SELECT CONCAT(GRA_TAB_NR, '/',GRA_GRD_ID, '.', IF(LOWER(DOC_EXTENSION)='jp2', 'jpg', LOWER(DOC_EXTENSION))) AS PATH FROM LINK_GRA_ART INNER JOIN GRAPHICS ON GRA_ID = LGA_GRA_ID INNER JOIN DOC_TYPES ON DOC_TYPE = GRA_DOC_TYPE WHERE LGA_ART_ID = @ARTICLE AND (GRA_LNG_ID = 16 OR GRA_LNG_ID = 255) AND GRA_DOC_TYPE <> 2 ORDER BY GRA_GRD_ID
SELECT ARL_KIND, IF (ART_LOOKUP.ARL_KIND = 2, SUPPLIERS.SUP_BRAND, BRANDS.BRA_BRAND) AS BRAND, ARL_DISPLAY_NR FROM ART_LOOKUP LEFT JOIN BRANDS ON BRA_ID = ARL_BRA_ID INNER JOIN ARTICLES ON ARTICLES.ART_ID = ART_LOOKUP.ARL_ART_ID INNER JOIN SUPPLIERS ON SUPPLIERS.SUP_ID = ARTICLES.ART_SUP_ID WHERE ARL_ART_ID = @ART_ID AND ARL_KIND IN (2, 3, 4) ORDER BY ARL_KIND, BRA_BRAND, ARL_DISPLAY_NR LIMIT 100
SELECT ART_ARTICLE_NR, SUP_BRAND, DES_TEXTS.TEX_TEXT AS ART_COMPLETE_DES_TEXT, DES_TEXTS2.TEX_TEXT AS ART_DES_TEXT, DES_TEXTS3.TEX_TEXT AS ART_STATUS_TEXT FROM ARTICLES INNER JOIN DESIGNATIONS ON DESIGNATIONS.DES_ID = ART_COMPLETE_DES_ID AND DESIGNATIONS.DES_LNG_ID = @LNG_ID INNER JOIN DES_TEXTS ON DES_TEXTS.TEX_ID = DESIGNATIONS.DES_TEX_ID LEFT JOIN DESIGNATIONS AS DESIGNATIONS2 ON DESIGNATIONS2.DES_ID = ART_DES_ID AND DESIGNATIONS2.DES_LNG_ID = @LNG_ID LEFT JOIN DES_TEXTS AS DES_TEXTS2 ON DES_TEXTS2.TEX_ID = DESIGNATIONS2.DES_TEX_ID INNER JOIN SUPPLIERS ON SUP_ID = ART_SUP_ID INNER JOIN ART_COUNTRY_SPECIFICS ON ACS_ART_ID = ART_ID INNER JOIN DESIGNATIONS AS DESIGNATIONS3 ON DESIGNATIONS3.DES_ID = ACS_KV_STATUS_DES_ID AND DESIGNATIONS3.DES_LNG_ID = @LNG_ID INNER JOIN DES_TEXTS AS DES_TEXTS3 ON DES_TEXTS3.TEX_ID = DESIGNATIONS3.DES_TEX_ID WHERE ART_ID = @ART_ID;
SELECT STR_ID, STR_ID_PARENT, TEX_TEXT AS STR_DES_TEXT, IF(EXISTS( SELECT * FROM SEARCH_TREE AS SEARCH_TREE2 WHERE SEARCH_TREE2.STR_ID_PARENT <=> SEARCH_TREE.STR_ID LIMIT 1 ), 1, 0) AS DESCENDANTS FROM SEARCH_TREE INNER JOIN DESIGNATIONS ON DES_ID = STR_DES_ID INNER JOIN DES_TEXTS ON TEX_ID = DES_TEX_ID WHERE STR_ID_PARENT <=> 10001 AND DES_LNG_ID = 16;
< script> // knum1,knum2,knum3,knum4,knum5 - // inum - // pz,pr - // lim - // wh1, wh2 - // count - // art_id - //name - //num_fnd - tecDoc var from = 3; var to = 3; var percent = 0; var chk = 0; var cond = ''; function get_list(fromf,tof) { $.post( "/admin/import_excel_new/get_list.php", { from: fromf, to: tof },outputt ); function outputt(data) { if(chk == 0) { from += 1; to += 1; percent = ( from / cond ) * 100; } else { from = cond; percent = ( from / cond ) * 100; } if ((to - cond) > 0) { to = cond; chk = 1; get_list(from,to); to = 0; }else if((to - cond) == 0) { chk = 1; get_list(from,to); to = 0; } document.getElementById("perc").innerHTML=percent.toFixed(2)+"%"; $("#progressbar").children(".ui-progressbar-value").css("width", percent+"%"); document.getElementById("tab_cont").innerHTML+=data; if(chk == 1) { $("#progressbar").css("display", "none"); $("#progresspercent").css("display", "none"); } if ( chk == 0) { get_list(from,to); //setTimeout(get_list, 100, from, to); } } } alert(" , !"); get_list(from,to); function createWindow(count,art_id,inum,knum1,knum2,name,knum3,knum4,knum5,wh1, wh2,pz,pr,num_fnd,lim) { $.post( "/admin/import_excel_new/get_tab.php", { id: art_id, num_fnd: num_fnd },outputt2 ); function outputt2(data) { document.getElementById("inum").innerHTML=inum; document.getElementById("cntnt").innerHTML=data; document.getElementById("btn").innerHTML="<input type=\"button\" name=\"add\" id=\"add_id\" style=\"float:right; margin-top:5px;\" value=\"\" onclick=\"insert_item(\'"+count+"\', \'"+inum+"\',\'"+knum1+"\',\'"+knum2+"\',\'"+name+"\', \'"+knum3+"\',\'"+knum4+"\',\'"+knum5+"\',\'"+wh1+"\', \'"+wh2+"\',\'"+pz+"\',\'"+pr+"\',\'"+num_fnd+"\', \'"+lim+"\')\" />"; } document.getElementById("open_block").style.display="block"; } function loadNum() { bnum = document.getElementById("brand_id").value; $.post( "/admin/import_excel_new/get_number.php", { num: bnum },outputt11 ); function outputt11(data) { document.getElementById("list_num").innerHTML=data; } } function insert_item(count,inum,knum1,knum2,name,knum3,knum4,knum5,wh1,wh2,pz, pr,num_fnd,lim) { if (document.getElementById("opt_id_1").checked === true) art_id=document.getElementById("art_list_id").value; else if (document.getElementById("opt_id_2").checked === true) art_id=document.getElementById("txtnum_id").value; if(document.getElementById("txtnum_id").value!="") { $.post( "/admin/import_excel_new/insert_item.php", { count: count, id: art_id, inum: inum, knum1: knum1, knum2: knum2, name: name, knum3: knum3, knum4: knum4, knum5: knum5, wh1: wh1, wh2: wh2, pz: pz, pr: pr, num_fnd: num_fnd, lim: lim },outputt3 ); function outputt3(data) { document.getElementById("id_"+inum).innerHTML="<span style=\'color:green;\'></span>"; document.getElementById("id_opt_"+inum).innerHTML="<a style=\"cursor:pointer; text-decoration:underline; color:#0090ff;\" onclick=\"createWindow(\'1\',\'"+data+"\', \'"+inum+"\',\'"+knum1+"\',\'"+knum2+"\',\'"+name+"\',\'"+knum3+"\',\'"+knum4+"\',\'"+knum5+"\', \'"+wh1+"\',\'"+wh2+"\',\'"+pz+"\',\'"+pr+"\',\'"+num_fnd+"\',\'"+lim+"\')\"></a>"; } } document.getElementById(\'open_block\').style.display=\'none\'; } </ script>
< ?php // $DataBase - // $knum1,$knum2,$knum3,$knum4,$knum5 - // $inum - // $pz,$pr - // $user - // $date - // $lim - // $wh1, $wh2 - // $nameProizvoditel, $numberProizvod - , function addToCatalogForNoTecdoc($DataBase,$knum1,$knum2,$knum3,$knum4, $knum5,$inum,$pr,$user,$date,$pz,$lim,$wh1,$wh2,$nameProizvoditel,$numberProizvod){ $symbols = array("`"," ", "~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-", "_", "=", "+", "/", "\\", "|", "?", ":", ";", "\"", "'", "â„–", ",", "."); $numberProizvodVithSymbols = str_replace($symbols, '', $numberProizvod); $nameProizvoditelUpper=strtoupper($nameProizvoditel); $query = " SELECT DISTINCT IF (ART_LOOKUP.ARL_KIND IN (3, 4), BRANDS.BRA_BRAND, SUPPLIERS.SUP_BRAND) AS brand, ART_LOOKUP.ARL_SEARCH_NUMBER AS NUMBER, `ARL_ART_ID` AS item_id, `ARL_SEARCH_NUMBER` AS num_fnd, `DES_TEXTS`.`TEX_TEXT` AS item_txt FROM ART_LOOKUP LEFT JOIN BRANDS ON BRANDS.BRA_ID = ART_LOOKUP.ARL_BRA_ID INNER JOIN ARTICLES ON ARTICLES.ART_ID = ART_LOOKUP.ARL_ART_ID INNER JOIN SUPPLIERS ON SUPPLIERS.SUP_ID = ARTICLES.ART_SUP_ID INNER JOIN DESIGNATIONS ON DESIGNATIONS.DES_ID = ARTICLES.ART_COMPLETE_DES_ID INNER JOIN DES_TEXTS ON DES_TEXTS.TEX_ID = DESIGNATIONS.DES_TEX_ID WHERE ART_LOOKUP.ARL_SEARCH_NUMBER = '".$numberProizvodVithSymbols."' AND ART_LOOKUP.ARL_KIND IN (1, 2, 3, 4) AND DESIGNATIONS.DES_LNG_ID = 16 AND (BRANDS.BRA_BRAND='".$nameProizvoditelUpper."' OR SUPPLIERS.SUP_BRAND='".$nameProizvoditelUpper."') GROUP BY brand, NUMBER ;"; $result1 = $DataBase->query($query); $row1 = mysql_fetch_array($result1); echo '<div class="'.$inum.'" style="display: none;"><b>'; var_dump($query); echo '</b>'; echo '<pre>'; var_dump($row1); echo '</pre></div>'; $art_id=$row1["item_id"]; $txt = $row1['item_txt']; $brand = $row1['brand']; $rez=array(); if($row1){ $rez['status']=true; }else{ $rez['status']=false; } if($rez['status']){ // $DataBase->Insert('shop_items_catalog_table', array( 'shop_currency_id' => '4', 'shop_shops_id' => '3', 'shop_items_catalog_name' => $brand.': '.$txt, 'shop_items_catalog_marking' => $art_id, 'shop_vendorcode' => $knum1, 'shop_extension' => $inum, 'shop_items_catalog_price' => $pr, 'users_id' => $user, 'shop_items_catalog_date_time' => $date, 'shop_items_catalog_putoff_date' => $date, 'shop_items_catalog_weight'=>0 )); $last_id = mysql_insert_id(); // function addToMarking($DataBase,$marking_id, $vendor_id){ if(trim($vendor_id)!="" && $vendor_id!=" "){ $DataBase->Insert('marking', array('marking_id' => $marking_id, 'vendor_id' => $vendor_id)); } } addToMarking($DataBase,$art_id, $numberProizvod); addToMarking($DataBase,$art_id, $knum1); addToMarking($DataBase,$art_id, $knum2); addToMarking($DataBase,$art_id, $knum3); addToMarking($DataBase,$art_id, $knum4); addToMarking($DataBase,$art_id, $knum5); // function addToShop_warehouse_items_table($DataBase,$shop_warehouse_id, $shop_items_catalog_item_id, $shop_warehouse_items_count, $users_id){ if(trim($vendor_id)!="" && $vendor_id!=" "){ $DataBase->Insert('shop_warehouse_items_table', array( 'shop_warehouse_id' => $shop_warehouse_id, 'shop_items_catalog_item_id' => $shop_items_catalog_item_id, 'shop_warehouse_items_count' => $shop_warehouse_items_count, 'users_id' => $users_id )); } } $whResult=0; if(trim($wh1)!=""){ $whResult=$wh1; }else{ $whResult=0; } addToShop_warehouse_items_table($DataBase,4, $last_id, $whResult, $user); if(trim($wh2)!=""){ $whResult=$wh2; }else{ $whResult=0; } addToShop_warehouse_items_table($DataBase,3, $last_id, $whResult, $user); addToShop_warehouse_items_table($DataBase,5, $last_id, 0, $user); function addToShop_prices_to_item_table ($DataBase,$last_id, $prices, $p){ $DataBase->Insert('shop_prices_to_item_table', array('shop_items_catalog_item_id' => $last_id, 'shop_list_of_prices_id' => $prices, 'shop_prices_to_item_value' => $p)); } // addToShop_prices_to_item_table ($DataBase,$last_id, 4, $pz); addToShop_prices_to_item_table ($DataBase,$last_id, 5, $pr); // $DataBase->Insert('shop_properties_items_table', array('shop_items_catalog_item_id' => $last_id, 'shop_list_of_properties_id' => 155, 'shop_properties_items_value' => $lim)); $param = array(); $param['item_id'] = $last_id; $param['path'] = 'item_' . $last_id; $DataBase->Update('shop_items_catalog_table', array('shop_items_catalog_item_id' => $param['item_id'], 'shop_items_catalog_path' => $param['path'] ), " `shop_currency_id` = '4' and `shop_shops_id` = '3' and `shop_items_catalog_name` = '".$brand . ': ' . $txt."' and `shop_items_catalog_marking` = ".$art_id ." and `shop_vendorcode` = '".$knum1."' and `shop_extension` = '".$inum."' and `shop_items_catalog_price` = ".$pr." " ); // $img=getImgForARTid($DataBase,$art_id); if($img) { $DataBase->Insert('shop_properties_items_table', array('shop_items_catalog_item_id' => $last_id, 'shop_list_of_properties_id' => 164, 'shop_properties_items_value' => $img)); } $img=''; } $rez['str_item']=$art_id; $rez['str_num_find']=$row1["num_fnd"]; return $rez; } ?>
Source: https://habr.com/ru/post/195946/
All Articles