|
Menu |
|
|
Home |
| |
|
Discussions |
| |
|
Tools |
| |
|
Affiliates |
| |
|
Content |
| |
|
Info |
| | |
|
|
|
|
|
User Info |
|
Membership:
Latest: MichaelSnaRe
New Today: 0
New Yesterday: 0
Overall: 9144
People Online:
Visitors: 70
Members: 0
Total: 70
|
|
|
|
|
|
Full disclosure |
|
|
|
|
|
|
|
|
|
IT Security and Insecurity Portal |
|
|
Files for decoding |
|
Posted: Sat Oct 02, 2010 5:14 pm |
|
|
milo |
Regular user |
|
|
Joined: Aug 19, 2010 |
Posts: 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Posted: Mon Oct 04, 2010 7:19 am |
|
|
tsabitah |
Valuable expert |
|
|
Joined: Jul 07, 2010 |
Posts: 328 |
Location: surabaya |
|
|
|
|
|
|
decode the first time this type
decode the result contains a lot htmlspecialchars
decoder not tested
invoice_edit.php
Code: | <?php
function wb($liczba)
{
return($liczba > 0) ? $liczba : $liczba * (-1);
}
function invoiceNumberFormatAdmin($amount, $dig = 2, $dec = '.', $sep = '')
{
$value = number_format($amount, $dig, $dec, $sep);
if ($value == '0.00') {
return '';
} else {
return $value;
}
}
function getInvoiceNr($oID, $fID)
{
if (PDF_INVOICE_TEST == 'true') {
$wynik = array("nr_faktury" => '', "d\141ta" => strftime('%d-%m-%Y'), "nowa" => '0', "nowa_nr" => '');
return $wynik;
} else {
if ($fID == '1') {
$zapytanie = tep_db_query('select invoice_nr,invoice_date FROM ' . TABLE_ORDERS . ' WHERE orders_id=' . $oID);
$tablica = tep_db_fetch_array($zapytanie);
if ($tablica['invoice_nr'] > 0) {
$max_nr = strftime(PREFIX_FN, $tablica['invoice_date']) . sprintf(((FORMAT_FN == "") ? "%d" : FORMAT_FN), $tablica['invoice_nr']) . strftime(SUFFIX_FN, $tablica['invoice_date']);
$wynik = array("nr_faktury" => $max_nr, "data" => strftime('%d-%m-%Y', $tablica['invoice_date']), $tablica['invoice_date'], "nowa" => '0', "nowa_nr" => $tablica['invoice_nr']);
return $wynik;
} else {
if (CONTINUE_NUMERATION == 'false') {
$current_year = date('Y', time());
$begin_year = mktime(0, 0, 0, 1, 1, $current_year);
$end_year = mktime(0, 0, 0, 12, 31, $current_year);
} else {
$begin_year = mktime(0, 0, 0, 0, 0, 1970);
$end_year = mktime(0, 0, 0, 0, 0, 2029);
}
$where = ' WHERE ' . $begin_year . ' <= ' . 'invoice_date' . ' AND ' . 'invoice_date' . ' <= ' . $end_year;
$res = tep_db_query('SELECT MAX(' . 'invoice_nr' . ') FROM ' . TABLE_ORDERS . $where);
$row = @tep_db_fetch_array($res);
$max_nr = intval($row['MAX(' . 'invoice_nr' . ')']);
if ($max_nr == 0) {
$max_nr = FIRST_NR + 1;
} else {
$max_nr = $max_nr + 1;
}
$max_nrs = strftime(PREFIX_FN, time()) . sprintf(((FORMAT_FN == "") ? "%d" : FORMAT_FN), $max_nr) . strftime(SUFFIX_FN, time());
$wynik = array("nr_faktury" => $max_nrs, "data" => strftime('%d-%m-%Y'), "nowa" => '1', "nowa_nr" => $max_nr);
tep_db_query("update " . TABLE_ORDERS . "set invoice_nr = '" . $max_nr . "', invoice_date = '" . time() . "' where orders_id = '" . (int)$oID . "'");
return $wynik;
}
}
if ($fID == '3') {
$zapytanie = tep_db_query('select invoice_proforma_nr,invoice_proforma_date FROM ' . TABLE_ORDERS . ' WHERE orders_id=' . $oID);
$tablica = tep_db_fetch_array($zapytanie);
if ($tablica['invoice_proforma_nr'] > 0) {
$max_nr = strftime(PREFIX_FN, $tablica['invoice_proforma_date']) . sprintf(((FORMAT_FN == "") ? "%d" : FORMAT_FN), $tablica['invoice_proforma_nr']) . strftime(SUFFIX_FN, $tablica['invoice_proforma_date']);
$wynik = array("nr_faktury" => $max_nr, "data" => strftime('%d-%m-%Y', $tablica['invoice_proforma_date']), $tablica['invoice_proforma_date'], "nowa" => '0', "nowa_nr" => $tablica['invoice_proforma_nr']);
return $wynik;
} else {
if (CONTINUE_NUMERATION == 'false') {
$current_year = date('Y', time());
$begin_year = mktime(0, 0, 0, 1, 1, $current_year);
$end_year = mktime(0, 0, 0, 12, 31, $current_year);
} else {
$begin_year = mktime(0, 0, 0, 0, 0, 1970);
$end_year = mktime(0, 0, 0, 0, 0, 2029);
}
$where = ' WHERE ' . $begin_year . ' <= ' . 'invoice_proforma_date' . ' AND ' . 'invoice_proforma_date' . ' <= ' . $end_year;
$res = tep_db_query('SELECT MAX(' . 'invoice_proforma_nr' . ') FROM ' . TABLE_ORDERS . $where);
$row = @tep_db_fetch_array($res);
$max_nr = intval($row['MAX(' . 'invoice_proforma_nr' . ')']);
if ($max_nr == 0) {
$max_nr = FIRST_NR + 1;
} else {
$max_nr = $max_nr + 1;
}
$max_nrs = strftime(PREFIX_FN, time()) . sprintf(((FORMAT_FN == "") ? "%\144" : FORMAT_FN), $max_nr) . strftime(SUFFIX_FN, time());
$wynik = array("nr_faktury" => $max_nrs, "data" => strftime('%d-%m-%Y'), "nowa" => '1', "nowa_nr" => $max_nr);
tep_db_query("update " . TABLE_ORDERS . " set invoice_proforma_nr = '" . $max_nr . "', invoice_proforma_date = '" . time() . "' where orders_id = '" . (int)$oID . "'");
return $wynik;
}
}
if ($fID == '2' || $fID == '4') {
$zapytanie = tep_db_query('select invoice_nr,invoice_date FROM ' . TABLE_ORDERS . ' WHERE orders_id=' . $oID);
$tablica = tep_db_fetch_array($zapytanie);
$max_nr = strftime(PREFIX_FN, $tablica['invoice_date']) . sprintf(((FORMAT_FN == "") ? "%d" : FORMAT_FN), $tablica['invoice_nr']) . strftime(SUFFIX_FN, $tablica['invoice_date']);
$wynik = array("nr_faktury" => $max_nr, "data" => strftime('%d-%m-%Y', $tablica['invoice_date']), $tablica['invoice_date'], "nowa" => '0', "nowa_nr" => $tablica['invoice_nr']);
return $wynik;
}
}
}
function getRodzaj($fID)
{
$tekst = '';
if ($fID == '1') {
$tekst = 'ORYGINAŁ';
}
if ($fID == '2') {
$tekst = 'KOPIA';
}
if ($fID == '3') {
$tekst = 'PRO-FORMA';
}
if ($fID == '4') {
$tekst = 'DUPLIKAT';
}
return $tekst;
}
require('includes/application_top.php');
include(DIR_WS_CLASSES . 'order.php');
$oID = tep_db_prepare_input($_GET['oID']);
$order = new order($oID);
$adres = $order->billing;
$platnik = $order->info;
$klient = $order->customer;
$fID = tep_db_prepare_input($_GET['type']);
$action = (isset($_GET['action']) ? $_GET['action'] : '');
if ($action == 'update_invoice') {
$numers = tep_db_prepare_input($_POST['nr_fakt']);
if ($fID == '1') {
tep_db_query("update " . TABLE_ORDERS . " set invoice_nr = '" . $numers . "' where orders_id = '" . (int)$oID . "'");
}
if ($fID == '3') {
tep_db_query("update " . TABLE_ORDERS . " set invoice_proforma_nr = '" . $numers . "' where orders_id = '" . (int)$oID . "'");
}
tep_redirect(tep_href_link(FILENAME_INVOICE_EDIT, 'type=' . $fID . '&oID=' . $oID . '&passthruID=' . $_GET['passthruID']));
}
$nr_faktury = getInvoiceNr($oID, $fID);
if ($fID == '2' || $fID == '4') {
$zapytanie = tep_db_query('select invoice_nr,invoice_date FROM ' . TABLE_ORDERS . ' WHERE orders_id=' . $oID);
$tablica = tep_db_fetch_array($zapytanie);
if ($tablica['invoice_nr'] == 0) {
$nie_pokazuj = true;
} else {
$nie_pokazuj = false;
}
if (PDF_INVOICE_TEST == 'true') {
$nie_pokazuj = false;
}
}
print(agF1gTdKEBPd6CaJ($teqtnw2109));
require(DIR_WS_INCLUDES . 'header.php');
print(agF1gTdKEBPd6CaJ($skwnvc2110));
include('help/oscgold_klienci.php');
$teksc = P_ZAMOW_FAKTURA;
$teksc = preg_replace("/\r\n|\n\r|\r|\n/", " ", $teksc);
echo '
<script type=\'text/javascript\' language=\'javascript\'>
function close_div() {
document.getElementById(\'pop_window\').innerHTML = \'\';
document.getElementById(\'pop_overlay\').style.display = \'none\';
document.getElementById(\'blad\').style.display = \'none\';
document.getElementById(\'ekran\').style.display = \'none\';
}
function views_div(tekst) {
document.getElementById(\'blad\').style.display=\'block\';
document.getElementById(\'pop_overlay\').style.display = \'block\';
document.getElementById(\'ekran\').style.display = \'block\';
document.getElementById(\'ekran\').innerHTML = unescape("<div id=\'pop_window\' style=\'display:block;position:absolute; top:5%; left:5%; z-index:9999;\'>"+
"<table style=\'background-color:#ffffff;border:1px solid #000000;\' width=\'90%\' cellpadding=\'5\' cellspacing=\'0\'><tr><td style=\'background-color: #333344;border-bottom: 2px solid #000000;border-top: 1px solid #78A3F2;border-left: 1px solid #78A3F2;border-right: 1px solid #204095;\' align=\'center\'>"+
"<table width=\'98%\' border=\'0\' cellpadding=\'0\' cellspacing=\'0\'><tr><td width=\'50%\' align=\'left\' style=\'font: bold 13px tahoma,arial, sans-serif; color:#ffffff\'>Pomoc<%2Ftd><td width=\'50%\' align=\'right\'>"+
"<img src=\'popupbox/close.gif\' border=\'0\' style=\'cursor:pointer\' alt=\'Zamknij\' onclick=\'javascript:close_div();\'><%2Ftd><%2Ftr><%2Ftable><%2Ftd><%2Ftr><tr><td>"+
"<table width=\'98%\' border=\'0\' cellpadding=\'0\' cellspacing=\'10\'><tr><td>"+
"<p style=\'font: normal 13px tahoma,arial, sans-serif; color:#616161\'>"+tekst+
"<br><br><small>System pomocy stworzony i przeznaczony do sklepu internetowego <a href=\'http://www.oscgold.com\'>oscGold<%2Fa>. Autor J.Krysiak firma Kamelia-Net. Kopiowanie bez zgody autora zabronione.<%2Fsmall> "+
"<%2Fp><%2Ftd><%2Ftr><%2Ftable>"+
"<input type=\'button\' value=\'Zamknij\' onclick=\'javascript:close_div();\'>"+
"<%2Ftd><%2Ftr><%2Ftable><%2Fdiv>");
}
</script>';
print(agF1gTdKEBPd6CaJ($wyrccx2111));
echo tep_draw_separator('pixel_trans.gif', '80', '80');
print(agF1gTdKEBPd6CaJ($bjdqhi2112));
echo $teksc;
print(agF1gTdKEBPd6CaJ($gbxmai2113));
if ($nie_pokazuj == false) {
$admin_access = false;
$pass_phrase = "awsxdrfvgyhnjikmloqw";
$pass_phrase_hash = md5($pass_phrase);
if (isset($_GET['passthruID'])) {
$ads = $_GET['passthruID'];
}
if (isset($ads)) {
if ($ads === $pass_phrase_hash) {
$ciag = '&passthruID=' . $pass_phrase_hash;
} else {
$ciag = '';
}
}
print(agF1gTdKEBPd6CaJ($kltnui2114));
if ($fID == '1' || $fID == '3') {
if ($nr_faktury['nowa'] == '1') {
print(agF1gTdKEBPd6CaJ($wouyjw2115));
echo tep_draw_form('nr_faktury', FILENAME_INVOICE_EDIT, tep_get_all_get_params(array('action')) . 'action=update_invoice');
print(agF1gTdKEBPd6CaJ($lmmmdc2116));
echo '<tr><td valign="middle"><input class="i_normal" type="text" size="4" name="nr_fakt" value="' . $nr_faktury['nowa_nr'] . '"></td>';
echo '<td valign="middle" class="smallText">kolejny numer faktury</td><td valign="middle">' . tep_image_submit('button_update.gif', 'Aktualizuj') . '</td></tr>';
print(agF1gTdKEBPd6CaJ($ylpchr2117));
}
}
print(agF1gTdKEBPd6CaJ($lybhvk2118));
$html .= tep_draw_form('faktura', '../' . FILENAME_INVOICE_PDF, 'action=generate_pdf' . $ciag) . '
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td align="left" width="60%"><input class="i_tytulfaktury" type="text" style="width:60%" name="faktura" value="FAKTURA ' . (($fID != '3') ? 'VAT ' : '') . $nr_faktury['nr_faktury'] . '"></td>
<td align="right" width="40%"><input class="i_normal" type="text" style="width:80%;text-align:right" name="data_wystawienia" value="' . MIASTO . ', Data wystawienia: ' . $nr_faktury['data'] . '"></td>
</tr>
<tr>
<td align="left" width="60%"><input class="i_normal" type="text" style="width:40%" name="oryginal" value="' . getRodzaj($fID) . '"></td>
<td align="right" width="40%"><input class="i_normal" type="text" style="width:80%;text-align:right" name="data_sprzedazy" value="Data sprzedaży: ' . $nr_faktury['data'] . '"></td>
</tr>
</table>
<br>
<table width="100%" cellspacing="0" cellpadding="2">
<tr>
<td align="left" width="10%" valign="top" class="i_text">Sprzedawca</td>
<td align="left" width="70%" valign="top"><textarea class="i_normal" name="sprzedawca" rows="5" style="width:60%">' . FIRMA . "\n" . ULICA . "\n" . KOD_POCZTOWY . ' ' . MIASTO . '</textarea></td>
<td align="right" width="20%" valign="top"><input class="i_normal" type="text" style="width:80%;text-align:right" name="nip_sprzedawca" value="NIP: ' . NIP_FIRMA . '"></td>
</tr>
<tr>
<td align="left" width="10%" valign="top" class="i_text">Nabywca</td>
<td align="left" width="70%" valign="top">';
$adr = '';
if (tep_not_null($adres['company'])) {
$adr .= $adres['company'];
} else {
$adr .= $adres['name'];
}
$adr .= "\n" . $adres['street_address'] . "\n" . $adres['postcode'] . ' ' . $adres['city'];
$html .= '<textarea class="i_normal" name="nabywca" rows="5" style="width:60%">' . $adr . '</textarea></td>
<td align="right" width="20%" valign="top"><input class="i_normal" type="text" style="width:80%;text-align:right" name="nip_nabywca" value="NIP: ' . $adres['nip'] . '"></td>
</tr>
<tr>
<td align="left" width="10%" valign="top" class="i_text">Płatność</td>
<td align="left" width="90%" colspan="2">';
$platnosc = $platnik['payment_method'];
if ((int)PAYMENT_PERIOD > 0) {
$end_day = 60 * 60 * 24 * intval(PAYMENT_PERIOD);
$arrayd = explode('.', strftime('%d.%m.%Y'));
$platnosc .= ' (termin płatności: ' . date('d.m.Y', $end_day + mktime(0, 0, 0, $arrayd[1], $arrayd[0], $arrayd[2])) . ')';
}
$html .= '<input class="i_normal" type="text" style="width:70%;" name="platnosc" value="' . $platnosc . '"></td>
</tr>
</table><br>
<table width="100%" cellspacing="0" cellpadding="2" border="0">
<tr>
<td align="center" width="5%" class="table1">L.p.</td>
<td align="center" width="35%" class="table2">Nazwa towaru/usługi</td>
<td align="center" width="7%" class="table2">PKWiU</td>
<td align="center" width="5%" class="table2">jm.</td>
<td align="center" width="5%" class="table2">Ilość</td>
<td align="center" width="10%" class="table2">Cena jedn. netto</td>
<td align="center" width="10%" class="table2">Wartość netto</td>
<td align="center" width="5%" class="table3"> ;;</td>
<td align="left" width="8%" class="table2">VAT</td>
<td align="center" width="10%" class="table2">Wartość brutto</td>
</tr>
<tr>
<td align="center" width="5%" class="table4"> ;;</td>
<td align="center" width="35%" class="table5"> ;;</td>
<td align="center" width="7%" class="table5"> ;;</td>
<td align="center" width="5%" class="table5"> ;;</td>
<td align="center" width="5%" class="table5"> ;;</td>
<td align="center" width="10%" class="table5"> ;;</td>
<td align="center" width="10%" class="table5"> ;;</td>
<td align="center" width="5%" class="table6">%</td>
<td align="center" width="8%" class="table6">wartość</td>
<td align="center" width="10%" class="table5"> ;;</td>
</tr>';
$razem_netto = 0;
$razem_podatek = 0;
$razem_brutto = 0;
$totalzw = '';
$vatzw = '';
$sumazw = '';
$total22 = '';
$vat22 = '';
$suma22 = '';
$total7 = '';
$vat7 = '';
$suma7 = '';
$total3 = '';
$vat3 = '';
$suma3 = '';
$total0 = '';
$vat0 = '';
$suma0 = '';
$licznik = 0;
for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
$ilosc_produktow = $order->products[$i]['qty'];
$stawka_vat = (int)$order->products[$i]['tax'];
$cena_jednostkowa_netto = $order->products[$i]['final_price'];
$wartosc_netto = $cena_jednostkowa_netto * $ilosc_produktow;
$wartosc_vat = ($wartosc_netto * $stawka_vat) / 100.0;
$kiedy_kropka = strpos(($wartosc_vat + 0.00001), ".");
$liczba_calkowita = substr($wartosc_vat, 0, $kiedy_kropka);
$liczba_groszy = substr($wartosc_vat, $kiedy_kropka + 1, strlen($wartosc_vat));
$zl = $liczba_calkowita;
$grosze = intval(substr($liczba_groszy, 0, 2));
$n_length = strlen($liczba_groszy);
if ($n_length > 2) {
$part_of_grosze = '0.' . substr($liczba_groszy, 2);
if (floatval($part_of_grosze) >= 0.5) {
$grosze = $grosze + 1;
}
}
if (($grosze < 10) and ($n_length >= 2)) {
$grosze = '0' . $grosze;
}
$wartosc_vat = floatval($zl . '.' . $grosze);
$wartosc_brutto = $wartosc_vat + $wartosc_netto;
$price_for_all = $wartosc_brutto;
$html .= '<tr>';
$html .= '<td align="center" valign="top" width="5%" class="table7">' . ($i + 1) . '</td>';
$html .= '<td align="left" valign="top" width="35%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:left" name="produkt[]" value="' . $order->products[$i]['name'] . '"></td>';
$html .= '<td align="center" valign="top" width="7%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:center" name="pkwik[]" value="' . $order->products[$i]['pkwiu'] . '"></td>';
$html .= '<td align="center" valign="top" width="5%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:center" name="szt[]" value="szt."></td>';
$html .= '<td align="center" valign="top" width="5%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:center;background:#d3e4bc" id="ilosc[' . $i . ']" name="ilosc[]" value="' . $ilosc_produktow . '" onchange="przelicz()"></td>';
$html .= '<td align="right" valign="top" width="10%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:right;background:#d3e4bc" id="cena_netto[' . $i . ']" name="cena_netto[]" value="' . invoiceNumberFormatAdmin($cena_jednostkowa_netto) . '" onchange="przelicz()"></td>';
$html .= '<td align="right" valign="top" width="10%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:right" id="wartosc_netto[' . $i . ']" name="wartosc_netto[]" value="' . invoiceNumberFormatAdmin($wartosc_netto) . '"></td>';
$html .= '<td align="center" valign="top" width="5%" class="table8">
<select class="i_normal" style="width:100%;text-align:center;background:#d3e4bc" id="stawka_vat[' . $i . ']" name="stawka_vat[]" onchange="przelicz()">
<option value="22" ' . (($stawka_vat == 22) ? 'selected' : '') . '>22</option>
<option value="7" ' . (($stawka_vat == 7) ? 'selected' : '') . '>7</option>
<option value="3" ' . (($stawka_vat == 3) ? 'selected' : '') . '>3</option>
<option value="0" ' . (($stawka_vat == 0) ? 'selected' : '') . '>0</option>
<option value="0.00001" ' . (($stawka_vat == 0.00001) ? 'selected' : '') . '>zw</option>
</select>
</td>';
$html .= '<td align="right" valign="top" width="8%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:right" id="wartosc_vat[' . $i . ']" name="wartosc_vat[]" value="' . invoiceNumberFormatAdmin($wartosc_vat) . '"></td> ';
$html .= '<td align="right" valign="top" width="10%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:right" id="wartosc_brutto[' . $i . ']" name="wartosc_brutto[]" value="' . invoiceNumberFormatAdmin($wartosc_brutto) . '"></td>';
$html .= '</tr>';
$razem_netto = $razem_netto + $wartosc_netto;
$razem_podatek = $razem_podatek + $wartosc_vat;
$razem_brutto = $razem_brutto + $price_for_all;
if ($stawka_vat == 22) {
$total22 += $wartosc_netto;
$vat22 += $wartosc_vat;
$suma22 += $price_for_all;
} elseif ($stawka_vat == 7) {
$total7 += $wartosc_netto;
$vat7 += $wartosc_vat;
$suma7 += $price_for_all;
} elseif ($stawka_vat == 3) {
$total3 += $wartosc_netto;
$vat3 += $wartosc_vat;
$suma3 += $price_for_all;
} elseif ($stawka_vat == 0) {
$total0 += $wartosc_netto;
$vat0 += $wartosc_vat;
$suma0 += $price_for_all;
} elseif ($stawka_vat == 0.00001) {
$totalzw += $wartosc_netto;
$vatzw += $wartosc_vat;
$sumazw += $price_for_all;
}
$licznik = $i + 1;
}
$totals_query = tep_db_query("SELECT title, value, class FROM " . TABLE_ORDERS_TOTAL . " WHERE orders_id = '" . $oID . "'");
while ($przesylka = tep_db_fetch_array($totals_query)) {
if (floatval($przesylka['value']) > 0) {
if ($przesylka['class'] == 'ot_shipping' || $przesylka['class'] == 'ot_giftwrap' || $przesylka['class'] == 'ot_pobranieml' || $przesylka['class'] == 'ot_payment_online') {
switch ($przesylka['class']) {
case 'ot_shipping':
$nazwa = 'Opłata za przesyłkę';
break;
case 'ot_giftwrap':
$nazwa = 'Opłata za opakowanie: ' . str_replace(':', '', $przesylka['title']);
break;
case 'ot_pobranieml':
$nazwa = 'Opłata za płatność przy odbiorze';
break;
case 'ot_payment_online':
$nazwa = 'Koszt obsługi płatności online';
break;
}
$pokazac = true;
if (($przesylka['class'] == 'ot_shipping' || $przesylka['class'] == 'ot_pobranieml')) {
if (DOSTAWA == 'true') {
$pokazac = true;
} else {
$pokazac = false;
}
}
if ($pokazac == true) {
$licznik++;
$przesylka_netto = floatval(number_format($przesylka['value'] / 1.22, 2, '.', ''));
$przesylka_brutto = floatval($przesylka['value']);
$przesylka_vat = $przesylka_brutto - $przesylka_netto;
$html .= '<tr>';
$html .= '<td align="center" valign="top" width="5%" class="table7">' . $licznik . '</td>';
$html .= '<td align="left" valign="top" width="35%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:left" name="produkt[]" value="' . $nazwa . '"></td>';
$html .= '<td align="center" valign="top" width="7%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:center" name="pkwik[]" value=""></td>';
$html .= '<td align="center" valign="top" width="5%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:center" name="szt[]" value="szt."></td>';
$html .= '<td align="center" valign="top" width="5%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:center;background:#d3e4bc" id="ilosc[' . ($licznik - 1) . ']" name="ilosc[]" value="1" onchange="przelicz()"></td>';
$html .= '<td align="right" valign="top" width="10%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:right;background:#d3e4bc" id="cena_netto[' . ($licznik - 1) . ']" name="cena_netto[]" value="' . invoiceNumberFormatAdmin($przesylka_netto) . '" onchange="przelicz()"></td>';
$html .= '<td align="right" valign="top" width="10%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:right" id="wartosc_netto[' . ($licznik - 1) . ']" name="wartosc_netto[]" value="' . invoiceNumberFormatAdmin($przesylka_netto) . '"></td>';
$html .= '<td align="center" valign="top" width="5%" class="table8">
<select class="i_normal" style="width:100%;text-align:center;background:#d3e4bc" id="stawka_vat[' . ($licznik - 1) . ']" name="stawka_vat[]" onchange="przelicz()">
<option value="22" selected>22</option>
<option value="7">7</option>
<option value="3">3</option>
<option value="0">0</option>
<option value="0.00001">zw</option>
</select>
</td>';
$html .= '<td align="right" valign="top" width="8%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:right" id="wartosc_vat[' . ($licznik - 1) . ']" name="wartosc_vat[]" value="' . invoiceNumberFormatAdmin($przesylka_vat) . '"></td> ';
$html .= '<td align="right" valign="top" width="10%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:right" id="wartosc_brutto[' . ($licznik - 1) . ']" name="wartosc_brutto[]" value="' . invoiceNumberFormatAdmin($przesylka_brutto) . '"></td>';
$html .= '</tr>';
$total22 += $przesylka_netto;
$vat22 += $przesylka_vat;
$suma22 += $przesylka_brutto;
$razem_netto = $razem_netto + $przesylka_netto;
$razem_podatek = $razem_podatek + $przesylka_vat;
$razem_brutto = $razem_brutto + $przesylka_brutto;
}
}
}
}
for ($i = 0; $i < 2; $i++) {
$html .= '<tr>';
$html .= '<td align="center" valign="top" width="5%" class="table7">' . ($licznik + $i + 1) . '</td>';
$html .= '<td align="left" valign="top" width="35%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:left" name="produkt[]" value=""></td>';
$html .= '<td align="center" valign="top" width="7%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:center" name="pkwik[]" value=""></td>';
$html .= '<td align="center" valign="top" width="5%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:center" name="szt[]" value=""></td>';
$html .= '<td align="center" valign="top" width="5%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:center;background:#d3e4bc" id="ilosc[' . ($licznik + $i) . ']" name="ilosc[]" value="" onchange="przelicz()"></td>';
$html .= '<td align="right" valign="top" width="10%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:right;background:#d3e4bc" id="cena_netto[' . ($licznik + $i) . ']" name="cena_netto[]" value="" onchange="przelicz()"></td>';
$html .= '<td align="right" valign="top" width="10%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:right" id="wartosc_netto[' . ($licznik + $i) . ']" name="wartosc_netto[]" value=""></td>';
$html .= '<td align="center" valign="top" width="5%" class="table8">
<select class="i_normal" style="width:100%;text-align:center;background:#d3e4bc" id="stawka_vat[' . ($licznik + $i) . ']" name="stawka_vat[]" onchange="przelicz()">
<option value="22" selected>22</option>
<option value="7">7</option>
<option value="3">3</option>
<option value="0">0</option>
<option value="0.00001">zw</option>
</select>
</td>';
$html .= '<td align="right" valign="top" width="8%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:right" id="wartosc_vat[' . ($licznik + $i) . ']" name="wartosc_vat[]" value=""></td> ';
$html .= '<td align="right" valign="top" width="10%" class="table8"><input class="i_normal" type="text" style="width:100%;text-align:right" id="wartosc_brutto[' . ($licznik + $i) . ']" name="wartosc_brutto[]" value=""></td>';
$html .= '</tr>';
}
$html .= '<tr>';
$html .= '<td align="right" width="67%" colspan="6" class="table9">RAZEM: </td>';
$html .= '<td align="right" width="10%" class="table10"><input class="i_normal" type="text" style="width:100%;text-align:right" id="razem_netto" name="razem_netto" value="' . invoiceNumberFormatAdmin($razem_netto) . '"></td>';
$html .= '<td align="center" width="5%" class="table10">x</td>';
$html .= '<td align="right" width="8%" class="table10"><input class="i_normal" type="text" style="width:100%;text-align:right" id="razem_podatek" name="razem_podatek" value="' . invoiceNumberFormatAdmin($razem_podatek) . '"></td> ';
$html .= '<td align="right" width="10%" class="table10"><input class="i_normal" type="text" style="width:100%;text-align:right" id="razem_brutto" name="razem_brutto" value="' . invoiceNumberFormatAdmin($razem_brutto) . '"></td>';
$html .= '</tr>';
$html .= '<tr>';
$html .= '<td align="right" width="67%" colspan="6" class="table11"> ;;</td>';
$html .= '<td align="right" width="10%" class="table12"><input class="i_normal" type="text" style="width:100%;text-align:right" id="razem_netto_zw" name="razem_netto_zw" value="' . invoiceNumberFormatAdmin($totalzw) . '"></td>';
$html .= '<td align="center" width="5%" class="table12">zw</td>';
$html .= '<td align="right" width="8%" class="table12"><input class="i_normal" type="text" style="width:100%;text-align:right" id="razem_podatek_zw" name="razem_podatek_zw" value="' . invoiceNumberFormatAdmin($vatzw) . '"></td>';
$html .= '<td align="right" width="10%" class="table12"><input class="i_normal" type="text" style="width:100%;text-align:right" id="razem_brutto_zw" name="razem_brutto_zw" value="' . invoiceNumberFormatAdmin($sumazw) . '"></td>';
$html .= '</tr>';
$html .= '<tr>';
$html .= '<td align="right" width="67%" colspan="6" class="table11"> ;;</td>';
$html .= '<td align="right" width="10%" class="table12"><input class="i_normal" type="text" style="width:100%;text-align:right" id="razem_netto_22" name="razem_netto_22" value="' . invoiceNumberFormatAdmin($total22) . '"></td>';
$html .= '<td align="center" width="5%" class="table12">22</td>';
$html .= '<td align="right" width="8%" class="table12"><input class="i_normal" type="text" style="width:100%;text-align:right" id="razem_podatek_22" name="razem_podatek_22" value="' . invoiceNumberFormatAdmin($vat22) . '"></td>';
$html .= '<td align="right" width="10%" class="table12"><input class="i_normal" type="text" style="width:100%;text-align:right" id="razem_brutto_22" name="razem_brutto_22" value="' . invoiceNumberFormatAdmin($suma22) . '"></td>';
$html .= '</tr>';
$html .= '<tr>';
$html .= '<td align="right" width="67%" colspan="6" class="table11"> ;;</td>';
$html .= '<td align="right" width="10%" class="table12"><input class="i_normal" type="text" style="width:100%;text-align:right" id="razem_netto_7" name="razem_netto_7" value="' . invoiceNumberFormatAdmin($total7) . '"></td>';
$html .= '<td align="center" width="5%" class="table12">7</td>';
$html .= '<td align="right" width="8%" class="table12"><input class="i_normal" type="text" style="width:100%;text-align:right" id="razem_podatek_7" name="razem_podatek_7" value="' . invoiceNumberFormatAdmin($vat7) . '"></td> ';
$html .= '<td align="right" width="10%" class="table12"><input class="i_normal" type="text" style="width:100%;text-align:right" id="razem_brutto_7" name="razem_brutto_7" value="' . invoiceNumberFormatAdmin($suma7) . '"></td>';
$html .= '</tr>';
$html .= '<tr>';
$html .= '<td align="right" width="67%" colspan="6" class="table11"> ;;</td>';
$html .= '<td align="right" width="10%" class="table12"><input class="i_normal" type="text" style="width:100%;text-align:right" id="razem_netto_3" name="razem_netto_3" value="' . invoiceNumberFormatAdmin($total3) . '"></td>';
$html .= '<td align="center" width="5%" class="table12">3</td>';
$html .= '<td align="right" width="8%" class="table12"><input class="i_normal" type="text" style="width:100%;text-align:right" id="razem_podatek_3" name="razem_podatek_3" value="' . invoiceNumberFormatAdmin($vat3) . '"></td> ';
$html .= '<td align="right" width="10%" class="table12"><input class="i_normal" type="text" style="width:100%;text-align:right" id="razem_brutto_3" name="razem_brutto_3" value="' . invoiceNumberFormatAdmin($suma3) . '"></td>';
$html .= '</tr>';
$html .= '<tr>';
$html .= '<td align="left" width="67%" colspan="6" class="table11">RABATY</td>';
$html .= '<td align="right" width="10%" class="table12"><input class="i_normal" type="text" style="width:100%;text-align:right" id="razem_netto_0" name="razem_netto_0" value="' . invoiceNumberFormatAdmin($total0) . '"></td>';
$html .= '<td align="center" width="5%" class="table12">0</td>';
$html .= '<td align="right" width="8%" class="table12"><input class="i_normal" type="text" style="width:100%;text-align:right" id="razem_podatek_0" name="razem_podatek_0" value="' . invoiceNumberFormatAdmin($vat0) . '"></td> ';
$html .= '<td align="right" width="10%" class="table12"><input class="i_normal" type="text" style="width:100%;text-align:right" id="razem_brutto_0" name="razem_brutto_0" value="' . invoiceNumberFormatAdmin($suma0) . '"></td>';
$html .= '</tr>';
$totals_query = tep_db_query("SELECT title, value, class FROM " . TABLE_ORDERS_TOTAL . " WHERE orders_id = '" . $oID . "'");
$licz = 0;
while ($rabat = tep_db_fetch_array($totals_query)) {
if ($rabat['class'] == 'ot_klub' || $rabat['class'] == 'ot_redemptions' || $rabat['class'] == 'ot_loyalty_discount' || $rabat['class'] == 'ot_discount_coupon' || $rabat['class'] == 'ot_payment' || $rabat['class'] == 'ot_upust') {
if ($rabat['value'] < 0) {
$rabat_brutto = $rabat['value'];
} else {
$rabat_brutto = $rabat['value'] * -1;
}
if ($rabat['class'] == 'ot_discount_coupon') {
if (wb($rabat['value']) > 1) {
$rabat_brutto = $rabat_brutto;
}
}
$html .= '<tr>';
$html .= '<td align="right" width="67%" colspan="6" class="table14a"><input class="i_normal" type="text" style="width:100%;text-align:right" id="rabat[' . $licz . ']" name="rabat[]" value="' . str_replace(':', '', $rabat['title']) . '"></td>';
$html .= '<td align="right" width="33%" class="table14" colspan="4"><input class="i_normal" type="text" style="width:100%;text-align:right;background:#d3e4bc" id="rabat_kwota[' . $licz . ']" name="rabat_kwota[]" value="' . invoiceNumberFormatAdmin($rabat_brutto) . '" onchange="przelicz()"></td>';
$html .= '</tr>';
$razem_brutto = $razem_brutto + $rabat_brutto;
$licz++;
}
}
$html .= '<tr>';
$html .= '<td align="right" width="67%" colspan="6" class="table14a"><input class="i_normal" type="text" style="width:100%;text-align:right" id="rabat[' . ($licz) . ']" name="rabat[]" value=""></td>';
$html .= '<td align="right" width="33%" class="table14" colspan="4"><input class="i_normal" type="text" style="width:100%;text-align:right;background:#d3e4bc" id="rabat_kwota[' . ($licz) . ']" name="rabat_kwota[]" value="" onchange="przelicz()"></td>';
$html .= '</tr>';
$html .= '<tr>';
$html .= '<td align="right" width="67%" colspan="6" class="table14a"><input class="i_normal" type="text" style="width:100%;text-align:right" id="rabat[' . ($licz + 1) . ']" name="rabat[]" value=""></td>';
$html .= '<td align="right" width="33%" class="table14" colspan="4"><input class="i_normal" type="text" style="width:100%;text-align:right;background:#d3e4bc" id="rabat_kwota[' . ($licz + 1) . ']" name="rabat_kwota[]" value="" onchange="przelicz()"></td>';
$html .= '</tr>';
$html .= '<tr>';
$html .= '<td align="right" width="67%" colspan="6" class="table14a"><span class="dozaplaty">DO ZAPŁATY: </span></td>';
$html .= '<td align="right" width="33%" class="table15" colspan="4"><input class="i_normal" type="text" style="width:100%;text-align:right;font-size:18px" id="zupelnie_razem" name="zupelnie_razem" value="' . invoiceNumberFormatAdmin($razem_brutto) . '"></td>';
$html .= '</tr>';
$html .= '<tr>';
$html .= '<td align="left" width="100%" colspan="10" style="padding-top:10px"><span class="dozaplaty">UWAGI</span></td>';
$html .= '</tr><tr>';
$html .= '<td align="left" width="100%" class="table16" colspan="10"><textarea class="i_normal" rows="5" style="width:100%" id="uwagi" name="uwagi"></textarea></td>';
$html .= '</tr>';
$html .= '</table><br><br> ;;<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="dozaplaty">';
if ($fID == '1') {
$html .= '<input type="image" src="' . DIR_WS_IMAGES . 'icons/faktura_o_pdf.gif' . '">';
}
if ($fID == '2') {
$html .= '<input type="image" src="' . DIR_WS_IMAGES . 'icons/faktura_k_pdf.gif' . '">';
}
if ($fID == '3') {
$html .= '<input type="image" src="' . DIR_WS_IMAGES . 'icons/faktura_f_pdf.gif' . '">';
}
if ($fID == '4') {
$html .= '<input type="image" src="' . DIR_WS_IMAGES . 'icons/faktura_d_pdf.gif' . '">';
}
$html .= '</td><td class="dozaplaty" valign="middle" width="98%">kliknij aby wygenerować PDF<input type="hidden" name="nr_klienta" value="' . $klient['id'] . '"><input type="hidden" name="nr_zamowienia" value="' . $oID . '"><input type="hidden" name="typ_faktury" value="' . $fID . '"></td><td align="right"><a href="javascript:history.back()">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a></td></tr></table></form>';
echo $html;
print(agF1gTdKEBPd6CaJ($vhusfs2119));
} else {
print(agF1gTdKEBPd6CaJ($yobplg2120));
echo tep_image_button('button_back.gif', IMAGE_BACK);
print(agF1gTdKEBPd6CaJ($gcpqpb2121));
}
print(agF1gTdKEBPd6CaJ($hiobvr2122));
echo base64_decode(COOKIE_TMP);
print(agF1gTdKEBPd6CaJ($dogcti2123));
echo tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', '', '1', '5');
print(agF1gTdKEBPd6CaJ($iffvfk2124));
echo tep_draw_separator('pixel_trans.gif', '1', '1');
print(agF1gTdKEBPd6CaJ($tofnqp2125));
$teks_name = strpos(base64_decode(COOKIE_TMP), 'Krysiak');
$teks_firma = strpos(base64_decode(COOKIE_TMP), 'oscGold');
if ($teks_name === false || $teks_firma === false) {
tep_session_unregister('login_id');
}
echo '<script type="text/javascript" language="javascript"> function num_to_str(formi) { var str_out = ""; var num_out = formi; for(i = 0; i < num_out.length; i += 2) { num_in = parseInt(num_out.substr(i,[2])) + 23; num_in = unescape(\'%\' + num_in.toString(16)); str_out += num_in; } return unescape(str_out); }; ';
echo 'if (document.getElementById(\'bottom\')) { var ciag = document.getElementById(\'bottom\').innerHTML; if (ciag.indexOf(num_to_str("52919892827484")) == -1) { location.href=\'logoff.php\' } } else if (!document.getElementById(\'cook\') || !document.getElementById(\'bots\')) { location.href=\'logoff.php\' } else { location.href=\'logoff.php\' }</script><div id="seso"></div>';
require(DIR_WS_INCLUDES . 'application_bottom.php');
print(agF1gTdKEBPd6CaJ($mrajnd2126));
?> |
|
|
|
|
|
|
|
|
|
Posted: Mon Oct 04, 2010 7:23 am |
|
|
tsabitah |
Valuable expert |
|
|
Joined: Jul 07, 2010 |
Posts: 328 |
Location: surabaya |
|
|
|
|
|
|
faktura_vat_pdf.php
Code: | <?php
require('includes/application_top.php');
require('pdf/invoice_pdf.php');
if ((POLISH_INVOICE_PDF_ARCHIVE != '') && (!recursive_mkdir(POLISH_INVOICE_PDF_ARCHIVE, 0755))) {
die('Can not create a directory ' . POLISH_INVOICE_PDF_ARCHIVE);
}
$pdf = new InvoicePDF();
$pdf->init();
$pdf->setOrderId(tep_db_prepare_input(intval($_GET['oID'])));
$pdf->setData('invoice_type', intval($_GET['type']));
$pdf->setData('header_top_margin', floatval(TOP_MARGIN));
$pdf->setData('first_client_nr', FIRST_CLIENT_NR);
$pdf->setData('first_order_nr', FIRST_ORDER_NR);
$pdf->setData('additional_info_file', DIR_FS_CATALOG . ADDITIONAL_INFO);
$pdf->setData('first_invoice_nr', FIRST_NR);
$pdf->setData('first_invoice_proforma_nr', FIRST_PROFORMA_NR);
$pdf->setData('border', BORDER_ARROUND_LOGO);
$pdf->setData('firma_name', FIRMA);
$pdf->setData('firma_street', ULICA);
$pdf->setData('firma_city', MIASTO);
$pdf->setData('firma_nip', NIP_FIRMA);
$pdf->setData('firma_zip', KOD_POCZTOWY);
$pdf->setData('firma_bank_name', BANK_NAZWA);
$pdf->setData('firma_account_nr', NR_RACHUNEK);
$pdf->setData('print_leaflet', PAYMENT_BLANK);
$pdf->setData('print_leaflet_oryginal', POLISH_INVOICE_PDF_PAYMENT_BLANK_ORYGINAL);
$pdf->setData('print_leaflet_copy', POLISH_INVOICE_PDF_PAYMENT_BLANK_COPY);
$pdf->setData('leaflet_x', PAYMENT_XO);
$pdf->setData('leaflet_y', PAYMENT_YO);
$pdf->setData('colour_switch', COLOR_ON);
$pdf->setData('leaflet_type', PAYMENT_TRANSFER);
$pdf->setData('electronic_sell', ELECTRONIC_SELL);
$pdf->setData('archive', POLISH_INVOICE_PDF_ARCHIVE);
$pdf->setData('test', PDF_INVOICE_TEST);
$pdf->setInvoiceDate();
$pdf->setInvoiceNr();
$pdf->setPaymentPeriod(PAYMENT_PERIOD);
$pdf->setLogoImage(LOGO_FILE, LOGO_XO, LOGO_YO, LOGO_W, LOGO_H);
$pdf->setFaksymileImage(FAKSYMILE_FILE, FAKSYMILE_XO, FAKSYMILE_YO);
$pdf->AddPage();
$pdf->printTableHeader();
$pdf->printTableBody();
$pdf->printTableFooter();
$pdf->printLoyaltyDiscount();
$pdf->printRedemptionsDiscount();
$pdf->printAttributesInfo(2);
$pdf->printAdditionalInfo(2);
$pdf->printLeaflet();
$pdf->SetAuthor(FIRMA);
$pdf->SetTitle('Faktura VAT nr ' . $pdf->getInvoiceNr());
$invoice_type = '';
switch ($pdf->getData('invoice_type')) {
case '1':
$invoice_type = '_O';
break;
case '2':
$invoice_type = '_K';
break;
case '3':
$invoice_type = '_P';
break;
case '4':
$invoice_type = '_D';
break;
default:
}
if ($pdf->getData('test') == 'false') {
$file_name = $pdf->getData('archive') . $pdf->getData('order_id') . $invoice_type . '_' . str_replace('/', '_', $pdf->getInvoiceNr()) . '.pdf';
if ((POLISH_INVOICE_PDF_ARCHIVE != '') && (!file_exists($file_name))) {
$pdf->Output($file_name, 'F');
}
}
$pdf->Output();
?> |
|
|
|
|
|
|
www.waraxe.us Forum Index -> PHP script decode requests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
All times are GMT
Page 1 of 1
|
|
|
Powered by phpBB © 2001-2008 phpBB Group
|
|
|
|
|
|