PATH:
home
/
centosnipponia
/
cronjscript
/
old
<?php date_default_timezone_set("Europe/Amsterdam"); echo date("Y-m-d H:i:s"); $today_midnight = mktime(0, 0, 0, date("m") , date("d"), date("Y")); $today_midnight_mysql = date ('Y-m-d H:i:s',$today_midnight); require __DIR__ . '/config.php'; //makes add one if you need $makes = array("NIPPONIA", "DOOHAN", "LIFAN"); //sale orders $query_arguments=array('&','&','&',array('create_date','>=',$today_midnight_mysql),array('lot_id','!=',False),array(['location_id'][0],'=',2075),array('picking_code','=','outgoing')); $uii=$models->execute_kw($db, $uid, $password,'stock.move.line', 'search_read',array($query_arguments), array('limit'=>100)); $csv = "Company;Tranfer number;Make;Model;Colour;Speed;Qty;Destination Name;Destination Address;Destination Post Code;Destination City;Destination Country;Phone No.;Date created \n";//Column headers foreach($uii as $result) { $model_make=preg_replace('/[^A-Za-z0-9\-]/', ' ', explode("(",$result['product_id'][1])[0]); //this conserns the make $make_rec=""; foreach ($makes as $make) { if (str_contains($model_make, $make)) { $make_rec=$make; $model_make=str_replace($make.' ', '', $model_make); break; } } //this conserns the make //$csv.= '70267;Sale Order '.$result['order_id'][1].';'.$make_rec.';'.$model_make.';'.$result['x_scolorva2'].';'.preg_replace('!\s+!', ' ', str_replace("Speedversion: ","",$result['x_sspeedva2'])).';'.$result['product_uom_qty'].';'.str_replace(",", "-",$result['x_sdest_companyva2']).';'.$result['x_dest_street_va2'].';'.preg_replace('!\s+!', '', $result['x_sdest_zip_va2']).';'.$result['x_sdest_city_va2'].';'.$result['x_sdest_countryva2'].';'.$result['x_dest_ph_va'].';'.$result['create_date']." \n"; //Append data to csv $csv.= '70267;Sale Order '.$result['origin'].';'.$make_rec.';'.$model_make.';'.$result['x_colorva2'].';'.preg_replace('!\s+!', ' ', str_replace("Speedversion: ","",$result['x_speedva2'])).';1;'.$result['x_dest_companyva'].';'.$result['x_dest_street_va'].';'.preg_replace('!\s+!', '', $result['x_dest_zip_va']).';'.$result['x_dest_city_va'].';'.$result['x_dest_countryva'].';'.$result['x_dest_ph_va'].';'.$result['create_date']." \n"; //Append data to csv } //sale orders //internal tranfers $query_arguments=array('&','&','&',array('create_date','>=',$today_midnight_mysql),array('lot_id','=',False),array('picking_code','=','internal'),array(['location_id'][0],'=',2075)); $uii=$models->execute_kw($db, $uid, $password,'stock.move.line', 'search_read',array($query_arguments), array('limit'=>100)); foreach($uii as $result) { $model_make=preg_replace('/[^A-Za-z0-9\-]/', ' ', explode("(",$result['product_id'][1])[0]); //this conserns the make $make_rec=""; foreach ($makes as $make) { if (str_contains($model_make, $make)) { $make_rec=$make; $model_make=str_replace($make.' ', '', $model_make); break; } } //this conserns the make $qtyinternal=$result['product_uom_qty']+1; $csv.= '70267;Internal Tranfer '.$result['picking_id'][1].';'.$make_rec.';'.$model_make.';'.$result['x_colorva2'].';'.preg_replace('!\s+!', ' ', str_replace("Speedversion: ","",$result['x_speedva2'])).';'.$qtyinternal.';'.$result['x_dest_companyva'].';'.$result['x_dest_street_va'].';'.preg_replace('!\s+!', '', $result['x_dest_zip_va']).';'.$result['x_dest_city_va'].';'.$result['x_dest_countryva'].';'.$result['x_dest_ph_va'].';'.$result['create_date']." \n"; //Append data to csv } //internal tranfers $timestamp = strtotime("now"); $time = date('Y_m_d_his', $timestamp); $filenameunique=$time.'.csv'; $csv_handler = fopen ($filenameunique,'w'); fwrite ($csv_handler,$csv); fclose ($csv_handler); //var_dump($uii); require __DIR__ . '/ml.php'; ?>
[+]
..
[-] sql_command_update_trn.php
[edit]
[-] createandsend.php pld 14102021
[edit]
[-] createandsend.php-change-contact-address
[edit]
[-] createandsend.php-old2
[edit]
[-] createandsend.php-old11
[edit]
[-] createandsend.php - old major change 11102021
[edit]
[-] config.php-staging
[edit]
[-] createandsend.php-old1
[edit]
[-] createandsend.php-old181121
[edit]
[-] sql_command_del.php-old15102021
[edit]
[-] createandsend.php-170222
[edit]
[-] createandsend.php-301121
[edit]