105 lines
4.3 KiB
PHP
105 lines
4.3 KiB
PHP
<?php
|
|
|
|
// compare tables
|
|
global $app_list_strings;
|
|
$db = $GLOBALS['db'];
|
|
$query=$db->query("describe ecmreturnitems");
|
|
$fields=array();
|
|
while($r = $db->fetchByAssoc($query)){
|
|
$fields[]=$r;
|
|
}
|
|
//var_dump($fields);
|
|
|
|
$query2=$db->query("describe ecmreturnitems");
|
|
$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 ecmreturnitems 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 ecmreturnitems set id='".$r['id']."',
|
|
date_entered='".$r['date_entered']."',
|
|
date_modified='".$r['date_modified']."',
|
|
modified_user_id='".$r['modified_user_id']."',
|
|
assigned_user_id='".$r['assigned_user_id']."',
|
|
created_by='".$r['created_by']."',
|
|
deleted='".$r['deleted']."',
|
|
ecmreturn_id='".$r['ecmreturn_id']."',
|
|
ecmproduct_id='".$r['ecmproduct_id']."',
|
|
position='".$r['position']."',
|
|
code='".$r['code']."',
|
|
name='".$r['name']."',
|
|
quantity='".$r['quantity']."',
|
|
price_start='".$r['price']."',
|
|
total_netto='".$r['total']."',
|
|
dd_unit_id='".$r['dd_unit_id']."',
|
|
dd_unit_name='".$app_list_strings['ecmproducts_unit_dom'][$r['dd_unit_id']]."',
|
|
ecmproductcategory_id='".$r['ecmproductcategory_id']."'");
|
|
}
|
|
|
|
|
|
$db = $GLOBALS['db'];
|
|
$query=$db->query("describe ecmreturns");
|
|
$fields=array();
|
|
while($r = $db->fetchByAssoc($query)){
|
|
$fields[]=$r;
|
|
}
|
|
var_dump($fields);
|
|
|
|
$query2=$db->query("describe ecmreturns");
|
|
$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 ecmreturns");
|
|
$fields2=array();
|
|
while($r = $db->fetchByAssoc($query2)){
|
|
if($r['end_date']=='')$r['end_date']=null;
|
|
$db->query("INSERT INTO ecmreturns set id='".$r['id']."',
|
|
date_entered='".$r['date_entered']."',
|
|
date_modified='".$r['date_modified']."',
|
|
modified_user_id='".$r['modified_user_id']."',
|
|
assigned_user_id='".$r['assigned_user_id']."',
|
|
created_by='".$r['created_by']."',
|
|
deleted='".$r['deleted']."',
|
|
name='".$r['name']."',
|
|
description='".$r['description']."',
|
|
document_no='".$r['document_no']."',
|
|
number='".$r['number']."',
|
|
parent_id='".$r['parent_id']."',
|
|
parent_name='".$r['parent_name']."',
|
|
type='".$r['type']."',
|
|
status='".$r['status']."',
|
|
register_date='".$r['register_date']."',
|
|
validtill_date='".$r['validtill_date']."',
|
|
parent_address_street='".$r['parent_address_street']."',
|
|
parent_address_city='".$r['parent_address_city']."',
|
|
parent_address_postalcode='".$r['parent_address_postalcode']."',
|
|
parent_address_country='".$r['parent_address_country']."',
|
|
total_netto='".$r['total']."',
|
|
parent_nip='".$r['to_vatid']."'");
|
|
}
|
|
?>
|