192 lines
5.3 KiB
PHP
192 lines
5.3 KiB
PHP
<?php
|
|
|
|
// compare tables
|
|
|
|
$db = $GLOBALS['db'];
|
|
|
|
$query=$db->query("describe ecmreceiptitems");
|
|
$fields=array();
|
|
while($r = $db->fetchByAssoc($query)){
|
|
$fields[]=$r;
|
|
}
|
|
var_dump($fields);
|
|
|
|
$query2=$db->query("describe ecmreceiptitems");
|
|
$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 * from ecmreceiptitems order by date_entered desc");
|
|
$fields2=array();
|
|
global $app_list_strings;
|
|
while($r = $db->fetchByAssoc($query2)){
|
|
|
|
$db->query("INSERT INTO ecmreceiptitems VALUES(
|
|
'".$r['id']."'
|
|
,'".$r['date_entered']."'
|
|
,'".$r['date_modified']."'
|
|
,'".$r['modified_user_id']."'
|
|
,'".$r['assigned_user_id']."'
|
|
,'".$r['created_by']."'
|
|
,'".$r['deleted']."'
|
|
,'".$r['ecmreceipt_id']."'
|
|
,'".$r['ecmproduct_id']."'
|
|
,'".$r['position']."'
|
|
,'".$r['code']."'
|
|
,'".$r['name']."'
|
|
,'".$r['quantity']."'
|
|
,'".$r['startprice']."'
|
|
,'".$r['subprice']."'
|
|
,'".$r['price']."'
|
|
,'".$r['discount']."'
|
|
,'".$r['subtotal']."'
|
|
,'".$r['total']."'
|
|
,'".$r['dd_unit_id']."'
|
|
,'".$r['dd_unit_name']."'
|
|
,'".$r['ecmvat_id']."'
|
|
,'".$r['ecmvat_name']."'
|
|
,'".$r['ecmvat_value']."'
|
|
|
|
,'".$r['ecmproductcategory_id']."'
|
|
,'".$r['recipient_code']."'
|
|
,''
|
|
,'".$r['old_ecminvoiceoutitem_id']."'
|
|
,'".$r['old_subtotal']."'
|
|
,'".$r['old_quantity']."'
|
|
,'".$r['subtotal_corrected']."'
|
|
,'".$r['quantity_corrected']."'
|
|
,'".$r['old_total_vat']."'
|
|
,'".$total_vat."'
|
|
,'".$r['old_total']."'
|
|
,'".$r['total_corrected']."'
|
|
,'".$r['purchase_price']."'
|
|
,'".$r['parent_doc_id']."'
|
|
,'".$r['parent_doc_type']."'
|
|
,'".$r['parent_doc_item_id']."')");
|
|
|
|
}
|
|
|
|
|
|
$db = $GLOBALS['db'];
|
|
$query=$db->query("describe ecmreceipts");
|
|
$fields=array();
|
|
while($r = $db->fetchByAssoc($query)){
|
|
$fields[]=$r;
|
|
}
|
|
// var_dump($fields);
|
|
|
|
$query2=$db->query("describe ecmreceipts");
|
|
$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 ecmreceipts");
|
|
$fields2=array();
|
|
$po = new EcmPurchaseOrder();
|
|
|
|
echo "<pre>";
|
|
|
|
while($r = $db->fetchByAssoc($query2)){
|
|
$po->retrieve($r['id']);
|
|
// echo $r['id'];
|
|
$position_list=$po->getPositionList(true);
|
|
$vat=$po->calculate($position_list);
|
|
$vats_summary='';
|
|
$total_netto=0;
|
|
$total_brutto=0;
|
|
$total_vat=0;
|
|
$vats_summary=$r['total']-$r['subtotal'];
|
|
// var_dump($vat);
|
|
|
|
if($r['end_date']=='')$r['end_date']=null;
|
|
|
|
$db->query("INSERT INTO ecmreceipts VALUES(
|
|
'".$r['id']."'
|
|
,'".$r['name']."'
|
|
,'".$r['description']."'
|
|
,'".$r['date_entered']."'
|
|
,'".$r['date_modified']."'
|
|
,'".$r['modified_user_id']."'
|
|
,'".$r['assigned_user_id']."'
|
|
,'".$r['created_by']."'
|
|
,'".$r['deleted']."'
|
|
,'".$r['number']."'
|
|
,'".$r['document_no']."'
|
|
,'".$r['parent_type']."'
|
|
,'".$r['parent_name']."'
|
|
,'".$r['parent_id']."'
|
|
,'".$r['type']."'
|
|
,'".$r['status']."'
|
|
,'".$r['register_date']."'
|
|
,'".$r['parent_address_street']."'
|
|
,'".$r['parent_address_city']."'
|
|
,'".$r['parent_address_postalcode']."'
|
|
,'".$r['parent_address_country']."'
|
|
,'".$r['subtotal']."'
|
|
,'".$r['total']."'
|
|
,'".$r['discount']."'
|
|
,'".$vats_summary."'
|
|
,''
|
|
,'null'
|
|
,'".$r['ecmlanguage']."'
|
|
,''
|
|
,'".$r['footer_text']."'
|
|
,'".$r['contact_id']."'
|
|
,'".$r['ecmpaymentcondition_id']."'
|
|
,'".$r['ecmpaymentcondition_text']."'
|
|
|
|
,''
|
|
,'".$r['currency_id']."'
|
|
,'".$r['ecmreceipt_id']."'
|
|
,'".$r['ecmreceipt_name']."'
|
|
,'".$r['sell_date']."'
|
|
,'".$r['stock_id']."'
|
|
,'".$r['stock_name']."'
|
|
,'".$r['order_no']."'
|
|
,'".$r['supplier_code']."'
|
|
,'".$r['currency_value_nbp']."'
|
|
|
|
,'".$r['pdf_type']."'
|
|
,'".$r['parent_shipping_address_name']."'
|
|
,'".$r['parent_shipping_address_street']."'
|
|
,'".$r['parent_shipping_address_city']."'
|
|
,'".$r['parent_shipping_address_postalcode']."'
|
|
,'".$r['parent_shipping_address_country']."'
|
|
,'".$r['paid_val']."'
|
|
,'".$r['prepaid']."'
|
|
,'".$r['prepaid_nr']."'
|
|
,'".$r['payment_method_paid']."'
|
|
,'".$r['payment_date']."'
|
|
,'".$r['currency_value']."'
|
|
,'".$r['payment_date_d']."'
|
|
,'".$r['payment_method']."'
|
|
,'".$r['canceled']."'
|
|
,'".$total_vat."'
|
|
,'".$r['wz_id']."'
|
|
,'".$r['wz_name']."'
|
|
,'".$r['so_id']."'
|
|
,''
|
|
,''
|
|
,''
|
|
,''
|
|
,'')");
|
|
|
|
}
|
|
|
|
?>
|