type=='normal')$text='Nota nr'; if($focus->type=='corect')$text='Faktura korygująca nr'; $content = '

'.$text.' '.$focus->document_no.'

'; $content.=' '; $content.=' '; $content.='
'.$labels['LBL_PDF_CONTENT_INVOICE_FOR'].' '; if($focus->parent_shipping_address_name!=''){ $content.= ''.$labels['LBL_PDF_CONTENT_DELIVERY'].''; } $content.= '
' . $focus->parent_name . ' '.$focus->parent_shipping_address_name.'
' . $focus->parent_address_street . ' ' . $focus->parent_shipping_address_street . ' '; $content.= '
'. $focus->parent_address_postalcode . ' ' . $focus->parent_address_city; if (!is_null($focus->parent_address_country) & $focus->parent_address_country!='') $content.=', '.$focus->parent_address_country; $content.=' '. $focus->parent_shipping_address_postalcode . ' ' . $focus->parent_shipping_address_city; if (!is_null($focus->parent_shipping_address_country) & $focus->parent_shipping_address_country!='') $content.=', '.$focus->parent_shipping_address_country; $content.='
'; if (!is_null($focus->parent_nip) && $focus->parent_nip) { $content.=$labels['LBL_PDF_CONTENT_NIP'].' '.$focus->parent_nip; $nip = true; } if (!is_null($focus->parent_iln) && $focus->parent_iln) { if ($nip) $content.'
'; $nip = false; $content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->parent_iln; } $content.='
'; if (!is_null($focus->parent_shipping_nip) && $focus->parent_shipping_nip) { $content.=$labels['LBL_PDF_CONTENT_NIP'].' '.$focus->parent_shipping_nip; $nip = true; } if (!is_null($focus->parent_shipping_iln) && $focus->parent_shipping_iln) { if ($nip) $content.'
'; $nip = false; $content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->parent_shipping_iln; } $content.='
'; if ($focus->name && $focus->name != '') { $content .= '
' . $focus->name . '
'; } $content .= '
'.$labels['LBL_PDF_CONTENT_REGISTER_DATE'].' ' . $focus->register_date . ' '; if($focus->order_no!=''){ $content.=$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_NO'].':
'; } $content.='
'; if($focus->order_no!=''){ $content.='' . $focus->order_no.'
'; } $content.='

'; // start items table $columns = array (); $columns ['position'] = array ( 'field' => array ( 'position' ), 'label' => 'Lp.', 'align' => 'center' ); $columns ['name'] = array ( 'field' => array ( 'name', 'product_code' ), 'label' => 'Nazwa
Indeks', 'align' => 'left' ); $columns ['qty'] = array ( 'field' => array ( 'quantity', 'unit_name' ), 'label' => 'Ilość
J.m.', 'align' => 'right' ); $columns ['price_netto'] = array ( 'field' => array ( 'price_netto' ), 'label' => 'Cena', 'align' => 'right' ); $columns ['total_netto'] = array ( 'field' => array ( 'total_netto' ), 'label' => 'Wartość', 'align' => 'right' ); // set widths $totals = array (); $columns ['position'] ['width'] = '5'; $columns ['name'] ['width'] = '41'; $columns ['qty'] ['width'] = '10'; $columns ['price_netto'] ['width'] = '10'; $columns ['total_netto'] ['width'] = '10'; // rysujemy :) $content .= ' '; foreach ( $columns as $col ) { $content .= ' '; } $content .= ' '; $counter=1; if($focus->type=='normal'){ foreach ( $positions as $pos ) { $content .= ''; foreach ( $columns as $col ) { $content .= ''; } $content .= ''; } } else { foreach ( $positions as $pos ) { $content .= ''; foreach ( $columns as $col ) { $content .= ''; } $content .= ''; // old correct item $pos['name'] = 'było'; $pos['total_netto'] = $pos['old_total_netto']; $pos['total_brutto'] = $pos['old_total_brutto']; $pos['total_vat'] = $pos['old_total_vat']; $pos['price_netto'] = $pos['old_price_netto']; $pos['quantity'] = $pos['old_quantity']; $pos['position']=''; $pos['product_code']=' '; foreach ( $columns as $col ) { $content .= ''; } $content .= ''; } } $content .= '
' . $col ['label'] . '
'; foreach ( $col ['field'] as $f ) { if (! $pos [$f] || $pos [$f] == '') $pos [$f] = '-'; $content .= $pos [$f] . '
'; } $content .= '
'; foreach ( $col ['field'] as $f ) { if ((! $pos [$f] || $pos [$f] == '') && $f!='quantity') $pos [$f] = '-'; $content .= $pos [$f] . '
'; } $content .= '
'; foreach ( $col ['field'] as $f ) { if (! $pos [$f] || $pos [$f] == '') $pos [$f] = '-'; $content .= $pos [$f] . '
'; } $content .= '
'; // summary table // get currency symbol $c = new Currency (); $c->retrieve ( $focus->currency_id ); $symbol = $c->symbol; unset ( $c ); $content .= '
'; // totals $content .= ' '; $left_to_paid=$focus->total_brutto-$focus->paid_val; $content .= '
Razem '.format_number($focus->id=='c2d7473a-c0b8-6718-0947-54993423de20' ? 0 : $focus->total_netto).'
'; if($focus->id=='c2d7473a-c0b8-6718-0947-54993423de20'){ $left_to_paid='0'; $content .= ''; } if($focus->paid_val!='' && $focus->id!='c2d7473a-c0b8-6718-0947-54993423de20'){ if($focus->paid_val!=0)$pay_text=$GLOBALS['app_list_strings']['ecmpaymentconditions_payment_method_dom'][$focus->payment_method_paid]; $content .= ''; } if($focus->ecmpaymentcondition_id!=''){ $q= $db->query ( "select name from ecmpaymentconditions where id='$focus->ecmpaymentcondition_id'" ); $r=$db->fetchByAssoc($q); $paid_text='w Terminie '.$r['name'].' do '.date('d.m.Y',strtotime($focus->payment_date)).' '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method]; } else { if($focus->payment_date!=''){ $dni=(strtotime($focus->payment_date)-strtotime($focus->sell_date))/(3600*24); $paid_text='w Terminie '.$dni.' dni do '.date('d.m.Y',strtotime($focus->payment_date)).' '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method]; } } $content .= '
'.$labels['LBL_PDF_TO_PAY'].''.format_number($focus->total_brutto).' '.$symbol.'
Przedpłata8.610,00 '.$symbol.' Nr FK 001/14
'.$labels['LBL_PDF_PAID'].''.format_number($focus->paid_val).' '.$symbol.''.$pay_text.'
'.$labels['LBL_PDF_LEFT_TO_PAID'].''.format_number($left_to_paid).' '.$symbol.''.$paid_text.'

'.$labels['LBL_PDF_CONTENT_ISSUED_BY'].' '.$user->full_name.'



' . $focus->pdf_text . ' '; //echo $content; die();