35 lines
1.6 KiB
PHP
Executable File
35 lines
1.6 KiB
PHP
Executable File
<?php
|
|
|
|
global $current_user;
|
|
//$current_user->setPreference('test_preference_1', 'dziala');
|
|
echo $current_user->getPreference('test_preference_1');
|
|
|
|
return;
|
|
echo 't';
|
|
$db = $GLOBALS ['db'];
|
|
|
|
$inv = $db->query ( "SELECT * FROM ecminvoiceouts" );
|
|
|
|
while ( $i = $db->fetchByAssoc($inv) ) {
|
|
|
|
$invoice = new EcmInvoiceOut ();
|
|
$invoice->retrieve ( $i ['id'] );
|
|
|
|
$return_id = $i['id'];
|
|
|
|
echo $invoice->document_no.'<br>';
|
|
|
|
$res_count = $db->query ( "select id from ecmtransactions where record_id='" . $return_id . "' and deleted='0'" );
|
|
$count = $res_count->num_rows;
|
|
if ($count == 0) {
|
|
$GLOBALS ['db']->query ( "INSERT INTO ecmtransactions(id,name,date_entered,date_modified,modified_user_id,created_by,description,deleted,assigned_user_id,value,parent_name,parent_id,payment_date,type,paid,register_date,record_id,record_type,currency_id,currency_value)VALUES
|
|
('" . create_guid () . "','" . $invoice->document_no . "','" . date ( "Y-m-d H:i:s" ) . "','" . date ( "Y-m-d H:i:s" ) . "','" . $_SESSION ['authenticated_user_id'] . "','" . $_SESSION ['authenticated_user_id'] . "','" . $invoice->description . "','" . $invoice->deleted . "','" . $invoice->assigned_user_id . "','" . $invoice->total_brutto . "','" . $invoice->parent_name . "','" . $invoice->parent_id . "','" . $invoice->payment_date . "','0','" . $invoice->paid_val . "','" . $invoice->register_date . "','" . $return_id . "','EcmInvoiceOuts','" . $invoice->currency_id . "','" . $invoice->currency_value_nbp . "')" );
|
|
} else {
|
|
$db->query ( "update ecmtransactions set value='" . $total_brutto . "' where record_id='" . $return_id . "'" );
|
|
}
|
|
unset ( $invoice );
|
|
}
|
|
|
|
echo 'e';
|
|
|
|
?>
|