init
This commit is contained in:
112
modules/EcmInsideOrders/import.php
Normal file
112
modules/EcmInsideOrders/import.php
Normal file
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
// compare tables
|
||||
|
||||
$db = $GLOBALS['db'];
|
||||
$query=$db->query("describe ecminsideorderitems");
|
||||
$fields=array();
|
||||
while($r = $db->fetchByAssoc($query)){
|
||||
$fields[]=$r;
|
||||
}
|
||||
var_dump($fields);
|
||||
|
||||
$query2=$db->query("describe ecmproducts_ecminsideorders");
|
||||
$fields2=array();
|
||||
while($r = $db->fetchByAssoc($query2)){
|
||||
$fields2[]=$r;
|
||||
}
|
||||
|
||||
echo "<table><tr><td>Nazwa pola1</td><td>Nazwa pola2</td>";
|
||||
for($i=0;$i<count($fields2);$i++){
|
||||
echo "<tr><td>".$fields[$i]['Field']."</td><td>".$fields2[$i]['Field']."</td></tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
// dodawanie itemkow
|
||||
|
||||
$query2=$db->query("select i.*,p.unit_id,p.product_category_id from ecmproducts_ecminsideorders as i
|
||||
join ecmproducts as p on p.id=i.ecmproduct_id order by i.date_entered desc");
|
||||
$fields2=array();
|
||||
global $app_list_strings;
|
||||
while($r = $db->fetchByAssoc($query2)){
|
||||
if($r['product_component']==1){$a=$db->query("select quantity as quantity_comp from
|
||||
ecmproductcomponents where ecmcomponent_id='".$r['ecmproduct_id']."' and ecmproduct_id='".$r['product_product_id']."'");
|
||||
$c = $db->fetchByAssoc($a);
|
||||
}
|
||||
$db->query("INSERT INTO ecminsideorderitems VALUES(
|
||||
'".$r['id']."'
|
||||
,'".$r['date_entered']."'
|
||||
,'".$r['date_modified']."'
|
||||
,'".$r['modified_user_id']."'
|
||||
,'".$r['assigned_user_id']."'
|
||||
,'".$r['created_by']."'
|
||||
,'".$r['deleted']."'
|
||||
,'".$r['ecminsideorder_id']."'
|
||||
,'".$r['ecmproduct_id']."'
|
||||
,'".$r['product_position']."'
|
||||
,'".$r['product_code']."'
|
||||
,'".$r['product_name']."'
|
||||
,'".$r['product_quantity']."'
|
||||
,'".$r['product_component']."'
|
||||
,'".$r['product_product_id']."'
|
||||
,'".$r['unit_id']."'
|
||||
,'".$app_list_strings['ecmproducts_unit_dom'][$r['unit_id']]."'
|
||||
,'".$r['product_category_id']."'
|
||||
,'".$c['quantity_comp']."')");
|
||||
}
|
||||
|
||||
|
||||
$db = $GLOBALS['db'];
|
||||
$query=$db->query("describe ecminsideorders");
|
||||
$fields=array();
|
||||
while($r = $db->fetchByAssoc($query)){
|
||||
$fields[]=$r;
|
||||
}
|
||||
var_dump($fields);
|
||||
|
||||
$query2=$db->query("describe ecminsideorders");
|
||||
$fields2=array();
|
||||
while($r = $db->fetchByAssoc($query2)){
|
||||
$fields2[]=$r;
|
||||
}
|
||||
|
||||
echo "<table><tr><td>Nazwa pola1</td><td>Nazwa pola2</td>";
|
||||
for($i=0;$i<count($fields2);$i++){
|
||||
echo "<tr><td>".$fields[$i]['Field']."</td><td>".$fields2[$i]['Field']."</td></tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
$query2=$db->query("select * from ecminsideorders");
|
||||
$fields2=array();
|
||||
while($r = $db->fetchByAssoc($query2)){
|
||||
if($r['end_date']=='')$r['end_date']=null;
|
||||
$db->query("INSERT INTO ecminsideorders VALUES(
|
||||
'".$r['id']."'
|
||||
,'".$r['name']."'
|
||||
,'".$r['description']."'
|
||||
,'".$r['date_entered']."'
|
||||
,'".$r['modified_user_id']."'
|
||||
,'".$r['date_modified']."'
|
||||
,'".$r['assigned_user_id']."'
|
||||
,'".$r['created_by']."'
|
||||
,'".$r['deleted']."'
|
||||
,'".$r['number']."'
|
||||
,'".$r['document_no']."'
|
||||
,'".$r['register_date']."'
|
||||
,'".$r['total']."'
|
||||
,'".$r['ads_text']."'
|
||||
,'".$r['rw_stock_id']."'
|
||||
,'".$r['pw_stock_id']."'
|
||||
,'".$r['parent_name']."'
|
||||
,'".$r['parent_address_street']."'
|
||||
,'".$r['parent_address_city']."'
|
||||
,'".$r['parent_address_postalcode']."'
|
||||
,'".$r['parent_address_country']."'
|
||||
,'".$r['parent_name']."'
|
||||
,'".$r['parent_id']."'
|
||||
,'".$r['end_date']."'
|
||||
,'".$r['employers']."'
|
||||
,'".$r['rw_id']."'
|
||||
,'".$r['pw_id']."')");
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user