function receipt_data($x, $y) { global $receipt, $pdf; $font_size = 12; $yy = $y; $xmax = $x + 420; $pdf->line($x, $y, $xmax, $y); $y -= 8; text_align_center($x + 140, $y, 8, iconv("UTF-8", "ISO-8859-2", trans('For what'))); text_align_center($x + 315, $y, 8, iconv("UTF-8", "ISO-8859-2", trans('Value'))); text_align_center($x + 385, $y, 8, iconv("UTF-8", "ISO-8859-2", trans('Number'))); $y -= 2; $pdf->line($x, $y, $xmax, $y); $y -= $font_size; $i = 0; if ($receipt['contents']) { foreach ($receipt['contents'] as $item) { $i++; text_align_left($x + 2, $y, $font_size - 2, '<b>' . $i . '.</b>'); $y = text_wrap($x + 15, $y, 270, $font_size - 2, iconv("UTF-8", "ISO-8859-2", $item['description']), ''); text_align_right($x + 345, $y + $font_size, $font_size - 2, iconv("UTF-8", "ISO-8859-2", moneyf($item['value']))); } } $y += $font_size / 2; $pdf->line($x, $y, $xmax, $y); $y -= $font_size; text_align_right($x + 275, $y - 6, $font_size - 2, '<b>' . iconv("UTF-8", "ISO-8859-2", trans('Total:')) . '</b>'); text_align_right($x + 345, $y - 6, $font_size - 2, '<b>' . iconv("UTF-8", "ISO-8859-2", moneyf($receipt['total'])) . '</b>'); $y -= text_align_center($x + 385, $y, 8, 'Symbole'); $y -= text_align_center($x + 385, $y, 8, 'PL. KAS. Nr'); $pdf->line($x, $yy, $x, $y); $pdf->line($x + 280, $yy, $x + 280, $y); $pdf->line($x + 350, $yy, $x + 350, $y); $pdf->line($xmax, $yy, $xmax, $y); $pdf->line($x, $y, $xmax, $y); $y -= 16; text_align_left($x + 2, $y, 8, iconv("UTF-8", "ISO-8859-2", trans('In words:'))); $y = text_wrap($x + 40, $y, 300, $font_size - 2, iconv("UTF-8", "ISO-8859-2", trans('$a dollars $b cents', to_words(floor($receipt['total'])), to_words($receipt['totalg']))), ''); $y -= 8; $y += $font_size / 2; $pdf->line($x, $yy, $x, $y); $pdf->line($x + 350, $yy, $x + 350, $y); $pdf->line($xmax, $yy, $xmax, $y); $pdf->line($x, $y, $xmax, $y); return $y; }
function invoice_balance() { global $pdf, $invoice, $LMS; $pdf->SetFont('arial', '', 7); $pdf->writeHTMLCell(0, 0, '', '', trans('Your balance on date of invoice issue:') . ' ' . moneyf($LMS->GetCustomerBalance($invoice['customerid'], $invoice['cdate'])), 0, 1, 0, true, 'L'); }
imagecopy($img, $FT0100A, 0, 10, 0, 0, imagesx($FT0100A), imagesy($FT0100A)); imagecopy($img, $FT0100B, 310, 10, 0, 0, imagesx($FT0100B), imagesy($FT0100B)); //odbiorca imagettftext($img, 8, 0, 47, 135, $black, $font, $division['name']); imagettftext($img, 8, 0, 47, 155, $black, $font, $division['address']); imagettftext($img, 8, 0, 47, 175, $black, $font, $division['zip'] . ' ' . $division['city']); imagettftext($img, 14, 0, 353, 48, $black, $font, $division['name']); imagettftext($img, 14, 0, 353, 100, $black, $font, $division['address'] . ' ' . $division['zip'] . ' ' . $division['city']); //numerkonta imagettftext($img, 11, 0, 48, 44, $black, $fontb, format_bankaccount($customer['bankaccount'])); $count = strlen($customer['bankaccount']); for ($i = 0; $i < $count; $i++) { imagettftext($img, 18, 0, 355 + $i * 30, 155, $black, $fontb, format_bankaccount($customer['bankaccount'][$i])); } $_GET['v'] = str_replace(',', '.', $_GET['v']); $value = moneyf($_GET['v']); $width = 0; for ($i = 0; $i < strlen($value); $i++) { $tmp = imagettfbbox(20, 0, $fontb, substr($value, $i, 1)); $width += $tmp[2]; } imageline($img, 810, 200, 1180 - $width - 10, 200, $black); imagettftext($img, 20, 0, 1180 - $width, 207, $black, $fontb, $value); $width = 0; for ($i = 0; $i < strlen($value); $i++) { $tmp = imagettfbbox(12, 0, $fontb, substr($value, $i, 1)); $width += $tmp[2]; } imageline($img, 50, 224, 300 - $width - 10, 224, $black); imagettftext($img, 12, 0, 300 - $width, 230, $black, $fontb, $value); $value = $_GET['v'];
$SESSION->remove('receiptcustomer'); $SESSION->remove('receipt'); $SESSION->remove('receiptadderror'); if (isset($_GET['print'])) { $SESSION->save('receiptprint', array('receipt' => $rid, 'which' => isset($_GET['which']) ? $_GET['which'] : '')); } $SESSION->redirect('?m=receiptlist®id=' . $receipt['regid'] . '#' . $rid); } break; case 'movecash': $value = str_replace(',', '.', $_POST['value']); $dest = $_POST['registry']; if ($value && $dest) { $cash = $DB->GetOne('SELECT SUM(value) FROM receiptcontents WHERE regid = ?', array($receipt['regid'])); if ($cash < $value) { $error['nocash'] = trans('There is no cash in selected registry! You can expense only $a.', moneyf($cash)); break; } $DB->BeginTrans(); if (!$receipt['number']) { $receipt['number'] = $LMS->GetNewDocumentNumber(DOC_RECEIPT, $receipt['numberplanid'], $receipt['cdate']); } else { if (!preg_match('/^[0-9]+$/', $receipt['number'])) { $error['number'] = trans('Receipt number must be integer!'); } elseif ($LMS->DocumentExists($receipt['number'], DOC_RECEIPT, $receipt['numberplanid'], $receipt['cdate'])) { $error['number'] = trans('Receipt number $a already exists!', $receipt['number']); } if ($error) { $receipt['number'] = $LMS->GetNewDocumentNumber(DOC_RECEIPT, $receipt['numberplanid'], $receipt['cdate']); } }
public function Table2($header, $invoice) { /* set the line width and headers font */ $this->SetFillColor(200, 200, 200); $this->SetTextColor(0); $this->SetDrawColor(0, 0, 0); $this->SetLineWidth(0.3); $this->SetFont('arial', 'B', 8); $margins = $this->getMargins(); $table_width = $this->getPageWidth() - ($margins['left'] + $margins['right']); /* invoice headers */ $heads['no'] = trans('No.'); $heads['name'] = trans('Name of Product, Commodity or Service:'); $heads['prodid'] = trans('Product ID:'); $heads['content'] = trans('Unit:'); $heads['count'] = trans('Amount:'); if (!empty($invoice['pdiscount']) || !empty($invoice['vdiscount'])) { $heads['discount'] = trans('Discount:'); } $heads['basevalue'] = 'Cena netto:'; //trans('Unitary Net Value:'); $heads['totalbase'] = trans('Net Value:'); $heads['taxlabel'] = trans('Tax Rate:'); $heads['totaltax'] = trans('Tax Value:'); $heads['total'] = trans('Gross Value:'); /* width of the columns on the invoice */ foreach ($heads as $name => $text) { //$h_width[$name] = $this->getStringWidth($text, '', 'B', 8); $h_width[$name] = $this->getWrapStringWidth($text, 'B'); } /* change the column widths if are wider than the header */ if ($invoice['content']) { foreach ($invoice['content'] as $item) { $t_width['no'] = 7; $t_width['name'] = $this->getStringWidth($item['description']); $t_width['prodid'] = $this->getStringWidth($item['prodid']); $t_width['content'] = $this->getStringWidth($item['content']); $t_width['count'] = $this->getStringWidth(sprintf('%.2f', $item['count'])); if (!empty($invoice['pdiscount'])) { $t_width['discount'] = $this->getStringWidth(sprintf('%.2f%%', $item['pdiscount'])); } elseif (!empty($invoice['vdiscount'])) { $t_width['discount'] = $this->getStringWidth(moneyf($item['vdiscount'])) + 1; } $t_width['basevalue'] = $this->getStringWidth(moneyf($item['basevalue'])) + 1; $t_width['totalbase'] = $this->getStringWidth(moneyf($item['totalbase'])) + 1; $t_width['taxlabel'] = $this->getStringWidth($item['taxlabel']) + 1; $t_width['totaltax'] = $this->getStringWidth(moneyf($item['totaltax'])) + 1; $t_width['total'] = $this->getStringWidth(moneyf($item['total'])) + 1; } } foreach ($t_width as $name => $w) { if ($w > $h_width[$name]) { $h_width[$name] = $w; } } if (isset($invoice['invoice']['content'])) { foreach ($invoice['invoice']['content'] as $item) { $t_width['no'] = 7; $t_width['name'] = $this->getStringWidth($item['description']); $t_width['prodid'] = $this->getStringWidth($item['prodid']); $t_width['content'] = $this->getStringWidth($item['content']); $t_width['count'] = $this->getStringWidth(sprintf('%.2f', $item['count'])); if (!empty($invoice['pdiscount'])) { $t_width['discount'] = $this->getStringWidth(sprintf('%.2f%%', $item['pdiscount'])); } elseif (!empty($invoice['vdiscount'])) { $t_width['discount'] = $this->getStringWidth(moneyf($item['vdiscount'])) + 1; } $t_width['basevalue'] = $this->getStringWidth(moneyf($item['basevalue'])) + 1; $t_width['totalbase'] = $this->getStringWidth(moneyf($item['totalbase'])) + 1; $t_width['taxlabel'] = $this->getStringWidth($item['taxlabel']) + 1; $t_width['totaltax'] = $this->getStringWidth(moneyf($item['totaltax'])) + 1; $t_width['total'] = $this->getStringWidth(moneyf($item['total'])) + 1; } } foreach ($t_width as $name => $w) { if ($w > $h_width[$name]) { $h_width[$name] = $w; } } /* dynamic setting the width of the table 'name' */ $sum = 0; foreach ($h_width as $name => $w) { if ($name != 'name') { $sum += $w; } } $h_width['name'] = $table_width - $sum; $h_head = 0; /* invoice data table headers */ foreach ($heads as $item => $name) { //$this->Cell($h_width[$item], 7, $heads[$item], 1, 0, 'C', 1, '', 1); $h_cell = $this->getStringHeight($h_width[$item], $heads[$item], true, false, 0, 1); if ($h_cell > $h_head) { $h_head = $h_cell; } } foreach ($heads as $item => $name) { $this->MultiCell($h_width[$item], $h_head, $heads[$item], 1, 'C', true, 0, '', '', true, 0, false, false, $h_head, 'M'); } $this->Ln(); $this->SetFont('arial', '', 7); $this->SetFillColor(255, 255, 255); $roznica_przed = $roznica_po = array(); /* invoice correction data */ if (isset($invoice['invoice'])) { $this->Ln(2); $this->writeHTMLCell(0, 0, '', '', '<b>' . trans('Was:') . '</b>', 0, 1, 0, true, 'L'); $this->Ln(1); $i = 1; if ($invoice['invoice']['content']) { foreach ($invoice['invoice']['content'] as $item) { $this->Cell($h_width['no'], 7, $i . '.', 1, 0, 'C', 0, '', 1); $this->multicell($h_width['name'], 7, $item['description'], 1, 'L', true, 0, '', '', true, 0, false, false, 7, 'M'); $this->Cell($h_width['prodid'], 7, $item['prodid'], 1, 0, 'C', 0, '', 1); $this->Cell($h_width['content'], 7, $item['content'], 1, 0, 'C', 0, '', 1); $this->Cell($h_width['count'], 7, sprintf('%.2f', $item['count']), 1, 0, 'C', 0, '', 1); if (!empty($invoice['pdiscount'])) { $this->Cell($h_width['discount'], 7, sprintf('%.2f%%', $item['pdiscount']), 1, 0, 'R', 0, '', 1); } elseif (!empty($invoice['vdiscount'])) { $this->Cell($h_width['discount'], 7, moneyf($item['vdiscount']), 1, 0, 'R', 0, '', 1); } $this->Cell($h_width['basevalue'], 7, moneyf($item['basevalue']), 1, 0, 'R', 0, '', 1); $this->Cell($h_width['totalbase'], 7, moneyf($item['totalbase']), 1, 0, 'R', 0, '', 1); $this->Cell($h_width['taxlabel'], 7, $item['taxlabel'], 1, 0, 'C', 0, '', 1); $this->Cell($h_width['totaltax'], 7, moneyf($item['totaltax']), 1, 0, 'R', 0, '', 1); $this->Cell($h_width['total'], 7, moneyf($item['total']), 1, 0, 'R', 0, '', 1); $this->Ln(); $i++; } } /* invoice correction summary table - headers */ $sum = 0; foreach ($h_width as $name => $w) { if (in_array($name, array('no', 'name', 'prodid', 'content', 'count', 'discount', 'basevalue'))) { $sum += $w; } } $this->SetFont('arial', 'B', 7); $this->Cell($sum, 5, trans('Total:'), 0, 0, 'R', 0, '', 1); $this->SetFont('arial', '', 8); $this->Cell($h_width['totalbase'], 5, moneyf($invoice['invoice']['totalbase']), 1, 0, 'R', 0, '', 1); $this->SetFont('arial', 'B', 8); $this->Cell($h_width['taxlabel'], 5, 'x', 1, 0, 'C', 0, '', 1); $this->SetFont('arial', '', 8); $this->Cell($h_width['totaltax'], 5, moneyf($invoice['invoice']['totaltax']), 1, 0, 'R', 0, '', 1); $this->Cell($h_width['total'], 5, moneyf($invoice['invoice']['total']), 1, 0, 'R', 0, '', 1); $this->Ln(); /* invoice correction summary table - data */ if ($invoice['invoice']['taxest']) { $i = 1; foreach ($invoice['invoice']['taxest'] as $item) { $this->SetFont('arial', 'B', 8); $this->Cell($sum, 5, trans('in it:'), 0, 0, 'R', 0, '', 1); $this->SetFont('arial', '', 8); $this->Cell($h_width['totalbase'], 5, moneyf($item['base']), 1, 0, 'R', 0, '', 1); $this->Cell($h_width['taxlabel'], 5, $item['taxlabel'], 1, 0, 'C', 0, '', 1); $this->Cell($h_width['totaltax'], 5, moneyf($item['tax']), 1, 0, 'R', 0, '', 1); $this->Cell($h_width['total'], 5, moneyf($item['total']), 1, 0, 'R', 0, '', 1); $this->Ln(); $roznica_przed[] = array('totalbase' => $item['base'], 'taxlabel' => $item['taxlabel'], 'totaltax' => $item['tax'], 'total' => $item['total']); $i++; } } /* reason of issue of invoice correction */ if ($invoice['reason'] != '') { $this->writeHTMLCell(0, 0, '', '', '<b>' . 'Przyczyna korekty: </b>' . ' ' . $invoice['reason'], 0, 1, 0, true, 'L'); } $this->writeHTMLCell(0, 0, '', '', '<b>' . trans('Corrected to:') . '</b>', 0, 1, 0, true, 'L'); $this->Ln(1); } /* invoice data */ $i = 1; $this->SetFont('arial', '', 7); foreach ($invoice['content'] as $item) { $this->Cell($h_width['no'], 7, $i . '.', 1, 0, 'C', 0, '', 1); $this->multicell($h_width['name'], 7, $item['description'], 1, 'L', true, 0, '', '', true, 0, false, false, 7, 'M'); $this->Cell($h_width['prodid'], 7, $item['prodid'], 1, 0, 'C', 0, '', 1); $this->Cell($h_width['content'], 7, $item['content'], 1, 0, 'C', 0, '', 1); $this->Cell($h_width['count'], 7, sprintf('%.2f', $item['count']), 1, 0, 'C', 0, '', 1); if (!empty($invoice['pdiscount'])) { $this->Cell($h_width['discount'], 7, sprintf('%.2f%%', $item['pdiscount']), 1, 0, 'R', 0, '', 1); } elseif (!empty($invoice['vdiscount'])) { $this->Cell($h_width['discount'], 7, moneyf($item['vdiscount']), 1, 0, 'R', 0, '', 1); } $this->Cell($h_width['basevalue'], 7, moneyf($item['basevalue']), 1, 0, 'R', 0, '', 1); $this->Cell($h_width['totalbase'], 7, moneyf($item['totalbase']), 1, 0, 'R', 0, '', 1); $this->Cell($h_width['taxlabel'], 7, $item['taxlabel'], 1, 0, 'C', 0, '', 1); $this->Cell($h_width['totaltax'], 7, moneyf($item['totaltax']), 1, 0, 'R', 0, '', 1); $this->Cell($h_width['total'], 7, moneyf($item['total']), 1, 0, 'R', 0, '', 1); $this->Ln(); $i++; } /* invoice summary table - headers */ $sum = 0; foreach ($h_width as $name => $w) { if (in_array($name, array('no', 'name', 'prodid', 'content', 'count', 'discount', 'basevalue'))) { $sum += $w; } } $this->SetFont('arial', 'B', 8); $this->Cell($sum, 5, trans('Total:'), 0, 0, 'R', 0, '', 1); $this->SetFont('arial', '', 8); $this->Cell($h_width['totalbase'], 5, moneyf($invoice['totalbase']), 1, 0, 'R', 0, '', 1); $this->SetFont('arial', 'B', 8); $this->Cell($h_width['taxlabel'], 5, 'x', 1, 0, 'C', 0, '', 1); $this->SetFont('arial', '', 8); $this->Cell($h_width['totaltax'], 5, moneyf($invoice['totaltax']), 1, 0, 'R', 0, '', 1); $this->Cell($h_width['total'], 5, moneyf($invoice['total']), 1, 0, 'R', 0, '', 1); $this->Ln(); /* invoice summary table - data */ if ($invoice['taxest']) { $i = 1; foreach ($invoice['taxest'] as $item) { $this->SetFont('arial', 'B', 8); $this->Cell($sum, 5, trans('in it:'), 0, 0, 'R', 0, '', 1); $this->SetFont('arial', '', 8); $this->Cell($h_width['totalbase'], 5, moneyf($item['base']), 1, 0, 'R', 0, '', 1); $this->Cell($h_width['taxlabel'], 5, $item['taxlabel'], 1, 0, 'C', 0, '', 1); $this->Cell($h_width['totaltax'], 5, moneyf($item['tax']), 1, 0, 'R', 0, '', 1); $this->Cell($h_width['total'], 5, moneyf($item['total']), 1, 0, 'R', 0, '', 1); $roznica_po[] = array('totalbase' => $item['base'], 'taxlabel' => $item['taxlabel'], 'totaltax' => $item['tax'], 'total' => $item['total']); $this->Ln(); $i++; } } $this->Ln(3); /* difference between the invoice and the invoice correction */ if (isset($invoice['invoice'])) { $total = $invoice['total'] - $invoice['invoice']['total']; $totalbase = $invoice['totalbase'] - $invoice['invoice']['totalbase']; $totaltax = $invoice['totaltax'] - $invoice['invoice']['totaltax']; $this->SetFont('arial', 'B', 8); $this->Cell($sum, 5, trans('Difference value:'), 0, 0, 'R', 0, '', 1); $this->SetFont('arial', '', 8); $this->Cell($h_width['totalbase'], 5, moneyf($totalbase), 1, 0, 'R', 0, '', 1); $this->SetFont('arial', 'B', 8); $this->Cell($h_width['taxlabel'], 5, 'x', 1, 0, 'C', 0, '', 1); $this->SetFont('arial', '', 8); $this->Cell($h_width['totaltax'], 5, moneyf($totaltax), 1, 0, 'R', 0, '', 1); $this->Cell($h_width['total'], 5, moneyf($total), 1, 0, 'R', 0, '', 1); $this->Ln(); for ($j = 0; $j < sizeof($roznica_przed); $j++) { $total = $roznica_po[$j]['total'] - $roznica_przed[$j]['total']; $totalbase = $roznica_po[$j]['totalbase'] - $roznica_przed[$j]['totalbase']; $totaltax = $roznica_po[$j]['totaltax'] - $roznica_przed[$j]['totaltax']; $this->SetFont('arial', 'B', 8); $this->Cell($sum, 5, trans('in it:'), 0, 0, 'R', 0, '', 1); $this->SetFont('arial', '', 8); $this->Cell($h_width['totalbase'], 5, moneyf($totalbase), 1, 0, 'R', 0, '', 1); $this->Cell($h_width['taxlabel'], 5, $roznica_po[$j]['taxlabel'], 1, 0, 'C', 0, '', 1); $this->Cell($h_width['totaltax'], 5, moneyf($totaltax), 1, 0, 'R', 0, '', 1); $this->Cell($h_width['total'], 5, moneyf($total), 1, 0, 'R', 0, '', 1); $this->Ln(); } } }
function smarty_modifier_money_format($number) { return moneyf($number); }
$descriptions = array(); if ($candidates) { foreach ($candidates as $idx => $row) { $desc = $row['name']; if ($row['serialnumber']) { $desc = $desc . " (S/N: " . $row['serialnumber'] . ")"; } $actions[$row['id']] = '?m=stckproductinfo&id=' . $row['productid']; $eglible[$row['id']] = escape_js(($row['deleted'] ? '<font class="blend">' : '') . truncate_str($desc, 100) . ($row['deleted'] ? '</font>' : '')); if (is_null($row['warranty'])) { $row['warranty'] = 'b/d'; } if ($row['leavedate'] < 1) { $row['leavedate'] = 'b/d'; } else { $row['leavedate'] = date("d/m/Y", $row['leavedate']); } $descriptions[$row['id']] = '<b>' . trans("Gross:") . " " . moneyf($row['pricesell']) . "</b> " . trans("Sold:") . " " . $row['leavedate'] . " " . trans("Warranty:") . " " . $row['warranty']; } } header('Content-type: text/plain'); if ($eglible) { print "this.eligible = [\"" . implode('","', $eglible) . "\"];\n"; print "this.descriptions = [\"" . implode('","', $descriptions) . "\"];\n"; print "this.actions = [\"" . implode('","', $actions) . "\"];\n"; } else { print "false;\n"; } } exit; break;
function invoice_balance_v2() { global $pdf, $invoice, $LMS; $pdf->SetFont('arial', '', 7); $kasa = $LMS->GetCustomerBalance($invoice['customerid'], $invoice['cdate']); $tekst = ''; $pdf->writeHTMLCell(0, 0, '', '', 'Saldo przed wystawieniem dokumentu:' . ' ' . moneyf($kasa), 0, 1, 0, true, 'L'); $pdf->setFont('arial','',6); $tekst = 'Informujemy, że saldo zostało wyliczone przed wystawieniem bieżącego dokumentu i może nie uwzględniać ostatnich wpłat ze względu na możliwe opóźnienia w realizacji przelewów bankowych. Dodatni stan salda oznacza nadpłatę. Jeżeli w wyniku wnoszenia opłat za pobrane towary lub wykonane usługi powstała nadpłata, podlega ona zaliczeniu na poczet płatności ustalonych na najbliższy okres rozliczenowy, o ile Odbiorca nie zarząda jej zwrotu. Dyspozycję zwrotu nadpłaty należy złożyć w Biurze Obsługi Klienta'; $pdf->writeHTMLCell(0, 0, '', '', $tekst, 0, 1, 0, true, 'J'); }
protected function receipt_data($x, $y) { $font_size = 12; $yy = $y; $xmax = $x + 420; $this->backend->line($x, $y, $xmax, $y); $y -= 8; $this->backend->text_align_center($x + 140, $y, 8, trans('For what')); $this->backend->text_align_center($x + 315, $y, 8, trans('Value')); $this->backend->text_align_center($x + 385, $y, 8, trans('Number')); $y -= 2; $this->backend->line($x, $y, $xmax, $y); $y -= $font_size; $i = 0; if ($this->data['contents']) { foreach ($this->data['contents'] as $item) { $i++; $this->backend->text_align_left($x + 2, $y, $font_size - 2, '<b>' . $i . '.</b>'); $y = $this->backend->text_wrap($x + 15, $y, 270, $font_size - 2, $item['description'], ''); $this->backend->text_align_right($x + 345, $y + $font_size, $font_size - 2, moneyf($item['value'])); } } $y += $font_size / 2; $this->backend->line($x, $y, $xmax, $y); $y -= $font_size; $this->backend->text_align_right($x + 275, $y - 6, $font_size - 2, '<b>' . trans('Total:') . '</b>'); $this->backend->text_align_right($x + 345, $y - 6, $font_size - 2, '<b>' . moneyf($this->data['total']) . '</b>'); $y -= $this->backend->text_align_center($x + 385, $y, 8, 'Symbole'); $y -= $this->backend->text_align_center($x + 385, $y, 8, 'PL. KAS. Nr'); $this->backend->line($x, $yy, $x, $y); $this->backend->line($x + 280, $yy, $x + 280, $y); $this->backend->line($x + 350, $yy, $x + 350, $y); $this->backend->line($xmax, $yy, $xmax, $y); $this->backend->line($x, $y, $xmax, $y); $y -= 16; $this->backend->text_align_left($x + 2, $y, 8, trans('In words:')); $y = $this->backend->text_wrap($x + 40, $y, 300, $font_size - 2, trans('$a dollars $b cents', to_words(floor($this->data['total'])), to_words($this->data['totalg'])), ''); $y -= 8; $y += $font_size / 2; $this->backend->line($x, $yy, $x, $y); $this->backend->line($x + 350, $yy, $x + 350, $y); $this->backend->line($xmax, $yy, $xmax, $y); $this->backend->line($x, $y, $xmax, $y); return $y; }
function DelBalance($id) { $this->exechook('lms_balance_del_before', $id); $row = $this->DB->GetRow('SELECT docid, itemid, cash.customerid AS cid, value, documents.type AS doctype, importid, comment FROM cash LEFT JOIN documents ON (docid = documents.id) WHERE cash.id = ? ', array($id)); if ($row['doctype'] == DOC_INVOICE || $row['doctype'] == DOC_CNOTE || $row['doctype'] == DOC_INVOICE_PRO) { $this->InvoiceContentDelete($row['docid'], $row['itemid']); } elseif ($row['doctype'] == DOC_RECEIPT) { $this->ReceiptContentDelete($row['docid'], $row['itemid']); } elseif ($row['doctype'] == DOC_DNOTE) { $this->DebitNoteContentDelete($row['docid'], $row['itemid']); } else { if (SYSLOG) { $cusname = $this->getcustomername($row['cid']); addlogs('skasowano zobowiązanie Pozycja: <b>"' . $row['comment'] . '"</b> na kwotę: <b>' . moneyf($row['value']) . '</b> dla ' . $cusname, 'e=rm;m=fin;c=' . $row['cid']); } $this->DB->Execute('DELETE FROM cash WHERE id = ?', array($id)); if ($row['importid']) { $this->DB->Execute('UPDATE cashimport SET closed = 0 WHERE id = ?', array($row['importid'])); } } $this->exechook('lms_balance_del_after', $id); }
function invoice_to_pay($x, $y) { global $pdf, $invoice; if (isset($invoice['rebate'])) { $y = $y - text_align_left($x, $y, 14, trans('To repay:') . ' ' . moneyf($invoice['value'])); } else { $y = $y - text_align_left($x, $y, 14, trans('To pay:') . ' ' . moneyf($invoice['value'])); } $y = $y - text_align_left($x, $y, 10, trans('In words:') . ' ' . trans('$a dollars $b cents', to_words(floor($invoice['value'])), to_words(round(($invoice['value'] - floor($invoice['value'])) * 100)))); return $y; }
$black = imagecolorallocate($img, 0, 0, 0); imagefilledrectangle($img, 0, 0, 733, 320, $white); $FT0100 = imagecreatefromjpeg(SYS_DIR . '/img/fbook.jpg'); imagecopy($img, $FT0100, 0, 0, 0, 0, imagesx($FT0100), imagesy($FT0100)); //lewy formularz imagettftext($img, 8, 0, 28, 22, $black, $fontb, format_bankaccount($customer['bankaccount'])); imagettftext($img, 8, 0, 28, 75, $black, $fontb, $division['shortname']); imagettftext($img, 8, 0, 28, 87, $black, $fontb, $division['address']); imagettftext($img, 8, 0, 28, 99, $black, $fontb, $division['zip'] . ' ' . $division['city']); $width = 0; for ($i = 0; $i < mb_strlen(moneyf($value)); $i++) { $tmp = imagettfbbox(9, 0, $fontb, substr(moneyf($value), $i, 1)); $width += $tmp[2]; } imageline($img, 28, 120, 200 - $width - 10, 120, $black); imagettftext($img, 9, 0, 200 - $width, 123, $black, $fontb, moneyf($value)); imagettftext($img, 8, 0, 28, 150, $black, $fontb, $name1); imagettftext($img, 8, 0, 28, 168, $black, $fontb, $name2); imagettftext($img, 8, 0, 28, 200, $black, $fontb, $address); imagettftext($img, 8, 0, 28, 218, $black, $fontb, $city); // prawy formularz imagettftext($img, 9, 0, 243, 23, $black, $fontb, $division['name']); imagettftext($img, 9, 0, 243, 50, $black, $fontb, $division['address'] . ', ' . $division['zip'] . ' ' . $division['city']); $con = substr($customer['bankaccount'], 0, 2); for ($i = 0; $i < strlen($con); $i++) { imagettftext($img, 12, 0, 241 + $i * 17, 76, $black, $fontb, format_bankaccount($con[$i])); } $con = substr($customer['bankaccount'], 2, 8); for ($i = 0; $i < strlen($con); $i++) { imagettftext($img, 12, 0, 277 + $i * 17, 76, $black, $fontb, format_bankaccount($con[$i])); }
function invoice_to_pay($x, $y) { global $pdf, $invoice; $y = $y - text_align_left($x, $y, 14, iconv("UTF-8", "ISO-8859-2", trans('To pay:')) . ' ' . iconv("UTF-8", "ISO-8859-2", moneyf($invoice['total']))); $y = $y - text_align_left($x, $y, 10, iconv("UTF-8", "ISO-8859-2", trans('In words:')) . ' ' . iconv("UTF-8", "ISO-8859-2", trans('$a dollars $b cents', to_words(floor($invoice['total'])), to_words(round(($invoice['total'] - floor($invoice['total'])) * 100))))); return $y; }
$SESSION->_saveSession(); $SMARTY->assign('adlink', '&tuck=' . $tuck); $SMARTY->assign('start', $start); $SMARTY->assign('page', $page); $SMARTY->assign('pagelimit', $pagelimit); $SMARTY->assign('listdata', $listdata); $SMARTY->assign('filtr', $filtr); $SMARTY->assign('lista', $lista); $SMARTY->assign('tuck', $tuck); $SMARTY->display('cashimportlist_box.html'); die; } elseif ($tuck == 'duplicate') { if (isset($_GET['odksieguj']) && isset($_GET['idw']) && isset($_GET['idc']) && intval($_GET['idw']) && intval($_GET['idc'])) { if (SYSLOG) { $info = $DB->GetRow('SELECT * FROM cash WHERE id = ? LIMIT 1;', array(intval($_GET['idw']))); addlogs('usunięto zduplikowaną wpłatę z importu na kwotę :' . moneyf($info['value']) . ' z dnia: ' . date('Y/m/d', $info['time']) . ' dla ' . $LMS->GetCustomerName($info['customerid']), 'e=rm;m=fin;c=' . $info['customerid']); } $DB->Execute('DELETE FROM cash WHERE id = ? AND customerid = ? ;', array(intval($_GET['idw']), intval($_GET['idc']))); } if (!isset($_GET['o'])) { $SESSION->restore('cil_' . $tuck . '_o', $o); } else { $o = $_GET['o']; } $SESSION->save('cil_' . $tuck . '_o', $o); if (isset($_GET['cid'])) { $cid = $_GET['cid']; } else { $SESSION->restore('cil_' . $tuck . '_cid', $cid); } $SESSION->save('cil_' . $tuck . '_cid', $cid);
function invoice_to_pay($x, $y) { global $pdf, $invoice; if (isset($invoice['rebate'])) { $y = $y - text_align_left($x, $y, 14, iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('To repay:')) . ' ' . iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($invoice['value']))); } else { $y = $y - text_align_left($x, $y, 14, iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('To pay:')) . ' ' . iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($invoice['value']))); } $y = $y - text_align_left($x, $y, 10, iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('In words:')) . ' ' . iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('$a dollars $b cents', to_words(floor($invoice['value'])), to_words(round(($invoice['value'] - floor($invoice['value'])) * 100))))); return $y; }
protected function invoice_to_pay($x, $y) { if (isset($this->data['rebate'])) { $y = $y - $this->backend->text_align_left($x, $y, 14, trans('To repay:') . ' ' . moneyf($this->data['value'])); } else { $y = $y - $this->backend->text_align_left($x, $y, 14, trans('To pay:') . ' ' . moneyf($this->data['value'])); } $y = $y - $this->backend->text_align_left($x, $y, 10, trans('In words:') . ' ' . trans('$a dollars $b cents', to_words(floor($this->data['value'])), to_words(round(($this->data['value'] - floor($this->data['value'])) * 100)))); return $y; }
protected function invoice_balance() { global $LMS; $this->backend->SetFont('arial', '', 7); $this->backend->writeHTMLCell(0, 0, '', '', trans('Your balance on date of invoice issue:') . ' ' . moneyf($LMS->GetCustomerBalance($this->data['customerid'], $this->data['cdate'])), 0, 1, 0, true, 'L'); }
protected function invoice_to_pay() { $this->backend->Ln(0); $this->backend->SetFont('arial', 'B', 14); $this->backend->writeHTMLCell(0, 0, '', '', trans('To pay:') . ' ' . moneyf($this->data['value']), 0, 1, 0, true, 'R'); $this->backend->SetFont('arial', '', 10); $this->backend->writeHTMLCell(0, 6, '', '', trans('In words:') . ' ' . trans('$a dollars $b cents', to_words(floor($this->data['value'])), to_words(round(($this->data['value'] - floor($this->data['value'])) * 100))), 0, 1, 0, true, 'R'); }
function parse_customer_data($data, $row) { global $DB; $amount = -$row['balance']; $data = preg_replace("/\\%bankaccount/", format_bankaccount(bankaccount($row['id'], $row['account'])), $data); $data = preg_replace("/\\%b/", $amount, $data); $data = preg_replace("/\\%date-y/", strftime("%Y"), $data); $data = preg_replace("/\\%date-m/", strftime("%m"), $data); $data = preg_replace("/\\%date_month_name/", strftime("%B"), $data); $deadline = $row['cdate'] + $row['paytime'] * 86400; $data = preg_replace("/\\%deadline-y/", strftime("%Y", $deadline), $data); $data = preg_replace("/\\%deadline-m/", strftime("%m", $deadline), $data); $data = preg_replace("/\\%deadline-d/", strftime("%d", $deadline), $data); $data = preg_replace("/\\%B/", $row['balance'], $data); $data = preg_replace("/\\%saldo/", moneyf($row['balance']), $data); $data = preg_replace("/\\%pin/", $row['pin'], $data); $data = preg_replace("/\\%cid/", $row['id'], $data); if (preg_match("/\\%abonament/", $data)) { $saldo = $DB->GetOne("SELECT SUM(value)\n\t\t\tFROM assignments, tariffs\n\t\t\tWHERE tariffid = tariffs.id AND customerid = ?\n\t\t\t\tAND (datefrom <= {$currtime} OR datefrom = 0)\n\t\t\t\tAND (dateto > {$currtime} OR dateto = 0)\n\t\t\t\tAND ((datefrom < dateto) OR (datefrom = 0 AND datefrom = 0))", array($row['id'])); $data = preg_replace("/\\%abonament/", $saldo, $data); } // invoices, debit notes $data = preg_replace("/\\%invoice/", $row['doc_number'], $data); $data = preg_replace("/\\%number/", $row['doc_number'], $data); $data = preg_replace("/\\%value/", $row['value'], $data); $data = preg_replace("/\\%cdate-y/", strftime("%Y", $row['cdate']), $data); $data = preg_replace("/\\%cdate-m/", strftime("%m", $row['cdate']), $data); $data = preg_replace("/\\%cdate-d/", strftime("%d", $row['cdate']), $data); list($now_y, $now_m) = explode('/', strftime("%Y/%m", time())); $data = preg_replace("/\\%lastday/", strftime("%d", mktime(12, 0, 0, $now_m + 1, 0, $now_y)), $data); return $data; }
function parse_customer_data($data, $row) { $DB = LMSDB::getInstance(); $amount = -$row['balance']; $totalamount = -$row['totalbalance']; $data = preg_replace("/\\%bankaccount/", format_bankaccount(bankaccount($row['id'], $row['account'])), $data); $data = preg_replace("/\\%b/", $amount, $data); $data = preg_replace("/\\%totalb/", $totalamount, $data); $data = preg_replace("/\\%date-y/", strftime("%Y"), $data); $data = preg_replace("/\\%date-m/", strftime("%m"), $data); $data = preg_replace("/\\%date_month_name/", strftime("%B"), $data); $deadline = $row['cdate'] + $row['paytime'] * 86400; $data = preg_replace("/\\%deadline-y/", strftime("%Y", $deadline), $data); $data = preg_replace("/\\%deadline-m/", strftime("%m", $deadline), $data); $data = preg_replace("/\\%deadline-d/", strftime("%d", $deadline), $data); $data = preg_replace("/\\%B/", $row['balance'], $data); $data = preg_replace("/\\%totalB/", $row['totalbalance'], $data); $data = preg_replace("/\\%saldo/", moneyf($row['balance']), $data); $data = preg_replace("/\\%totalsaldo/", moneyf($row['totalbalance']), $data); $data = preg_replace("/\\%pin/", $row['pin'], $data); $data = preg_replace("/\\%cid/", $row['id'], $data); if (preg_match("/\\%abonament/", $data)) { $saldo = $DB->GetOne("SELECT SUM(value)\n\t\t\tFROM assignments, tariffs\n\t\t\tWHERE tariffid = tariffs.id AND customerid = ?\n\t\t\t\tAND datefrom <= {$currtime} AND (dateto > {$currtime} OR dateto = 0)\n\t\t\t\tAND ((datefrom < dateto) OR (datefrom = 0 AND datefrom = 0))", array($row['id'])); $data = preg_replace("/\\%abonament/", $saldo, $data); } if (preg_match("/\\%last_10_in_a_table/", $data)) { $last10 = $DB->GetAll("SELECT comment, value, time FROM cash WHERE\n\t\t\tcustomerid = ? ORDER BY time DESC LIMIT 10", array($row['id'])); // ok, now we are going to rise up system's load $l10 = "-----------+-----------+----------------------------------------------------\n"; foreach ($last10 as $row_s) { $op_time = strftime("%Y/%m/%d", $row_s['time']); $op_amount = sprintf("%9.2f", $row_s['value']); $for_what = sprintf("%-52s", $row_s['comment']); $l10 = $l10 . "{$op_time} | {$op_amount} | {$for_what}\n"; } $l10 = $l10 . "-----------+-----------+----------------------------------------------------\n"; $data = preg_replace("/\\%last_10_in_a_table/", $l10, $data); } // invoices, debit notes $data = preg_replace("/\\%invoice/", $row['doc_number'], $data); $data = preg_replace("/\\%number/", $row['doc_number'], $data); $data = preg_replace("/\\%value/", $row['value'], $data); $data = preg_replace("/\\%cdate-y/", strftime("%Y", $row['cdate']), $data); $data = preg_replace("/\\%cdate-m/", strftime("%m", $row['cdate']), $data); $data = preg_replace("/\\%cdate-d/", strftime("%d", $row['cdate']), $data); list($now_y, $now_m) = explode('/', strftime("%Y/%m", time())); $data = preg_replace("/\\%lastday/", strftime("%d", mktime(12, 0, 0, $now_m + 1, 0, $now_y)), $data); return $data; }