105 lines
3.0 KiB
PHP
Executable File
105 lines
3.0 KiB
PHP
Executable File
<?php
|
|
|
|
function formatPDFPositionsEng($positions, $focus) {
|
|
$result = array();
|
|
|
|
|
|
foreach ($positions as $pos) {
|
|
|
|
$pos['quantity'] = intval($pos['quantity']);
|
|
$pos['old_quantity'] = intval($pos['old_quantity']);
|
|
|
|
$pos['position'] = intval($pos['position'])+1;
|
|
$pos['price_netto']=format_number($pos['price_netto']);
|
|
$pos['total_vat']=format_number($pos['total_vat']);
|
|
$pos['ecmvat_value']=format_number($pos['ecmvat_value']);
|
|
$pos['total_brutto']=format_number($pos['total_brutto']);
|
|
$pos['total_netto']=format_number($pos['total_netto']);
|
|
$pos['old_total_netto']=format_number($pos['old_total_netto']);
|
|
$pos['old_total_brutto']=format_number($pos['old_total_brutto']);
|
|
$pos['old_total_vat']=format_number($pos['old_total_vat']);
|
|
$pos['old_price_netto']=format_number($pos['old_price_netto']);
|
|
|
|
$result[] = $pos;
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
|
|
function formatPDFPositions($positions, $focus) {
|
|
$result = array();
|
|
foreach ($positions as $pos) {
|
|
$pos['position'] = intval($pos['position']) + 1;
|
|
$pos['quantity'] = number_format($pos['quantity'],$pos['product_precision'],",","");
|
|
$pos['old_quantity'] = number_format($pos['old_quantity'],$pos['product_precision'],",","");
|
|
$pos['ecmproduct_id'] = $pos['product_id'];
|
|
$pos['price_netto'] = format_number($pos['price_netto']);
|
|
$pos['total_vat'] = format_number($pos['total_vat']);
|
|
$pos['price_start'] = format_number($pos['price_start']);
|
|
$pos['discount'] = $pos['discount'].'%';
|
|
$pos['ecmvat_value'] = format_number($pos['ecmvat_value']);
|
|
$pos['total_brutto'] = format_number($pos['total_brutto']);
|
|
$pos['total_netto'] = format_number($pos['total_netto']);
|
|
$pos['recipient_code']=$pos['recipient_code'];
|
|
$result[] = $pos;
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
function formatPDFPositionsCorrect($pos, $focus) {
|
|
$pos['position'] = intval($pos['position']) + 1;
|
|
$pos['quantity'] = round($pos['quantity'],$pos['product_precision']);
|
|
$pos['price_netto'] = format_number($pos['price_netto']);
|
|
$pos['total_vat'] = format_number($pos['total_vat']);
|
|
$pos['ecmvat_value'] = format_number($pos['ecmvat_value']);
|
|
$pos['total_brutto'] = format_number($pos['total_brutto']);
|
|
$pos['total_netto'] = format_number($pos['total_netto']);
|
|
return $pos;
|
|
}
|
|
|
|
function mysql_escape_gpc($dirty) {
|
|
if (ini_get('magic_quotes_gpc')) {
|
|
return $dirty;
|
|
} else {
|
|
return mysql_real_escape_string($dirty);
|
|
}
|
|
}
|
|
|
|
function checkIsDiscount($positions, $focus) {
|
|
$result = array();
|
|
$discount=false;
|
|
foreach ($positions as $pos) {
|
|
|
|
if($pos['discount']!=0){
|
|
$discount=true;
|
|
}
|
|
|
|
}
|
|
return $discount;
|
|
}
|
|
function checkIsPK($positions, $focus) {
|
|
$result = array();
|
|
$oo=false;
|
|
foreach ($positions as $pos) {
|
|
|
|
$pr= new EcmProduct();
|
|
$pr->retrieve($pos['product_id']);
|
|
if($pr->pkwiu!=''){
|
|
$oo=true;
|
|
}
|
|
|
|
}
|
|
return $oo;
|
|
}
|
|
function checkIsOO($positions, $focus) {
|
|
$result = array();
|
|
$oo=false;
|
|
foreach ($positions as $pos) {
|
|
|
|
if($pos['ecmvat_id']=='a8c52d5e-15df-2a13-c934-5578307bebd2'){
|
|
$oo=true;
|
|
}
|
|
|
|
}
|
|
return $oo;
|
|
} |