PHP . SU
Программирование на PHP, MySQL и другие веб-технологии
Описание: куда вставить переменную
Поиск в теме | Версия для печати
serdr
Отправлено: 16 Ноября, 2011 - 18:57:33
Новичок
Покинул форум
Сообщений всего: 4
Дата рег-ции: Нояб. 2011
Помог: 0 раз(а)
не определяется переменная в модуле оплаты.
я так подразумеваю надо поставить переменную $num = 0; (может я не прав?)
только в какое место ее засунуть не знаю, подскажите (буду очень признателен?
есть три ошибки (на локалке правда все нормально, на сервере вылезает, может на сервере что подкрутить? PHP5.2.10)
Notice: Undefined offset: 3 in ................... : eval()'d code on line 321
Notice: Undefined variable: nomer in.................... eval()'d code on line 296
Notice: Undefined offset: 0 .................... : eval()'d code on line 86
Сам код:
PHP:
скопировать код в буфер обмена
<?PHP
/*
Модуль оплаты для VirtueMart 1.1.x / Joomla 1.5.x.
Содержит форму счет, стандартного вида, для оплаты между юр. лицами.
Автор модуля: программисты ecomsite
Сайт поддержки http://ecomsite.ru
Управляющие файлы: ps_fsch.php и ps_fsch.cfg.php
Распространяется по лицензии GNU/GPL
*/
?>
<?PHP class num2str
{
1
=> array ( 'один' , 'одна' ) , 2
=> array ( 'два' , 'две' ) , 3 => 'три' ,
4 => 'четыре' ,
5 => 'пять' ,
6 => 'шесть' ,
7 => 'семь' ,
8 => 'восемь' ,
9 => 'девять' ,
10 => 'десять' ,
11 => 'одиннадцать' ,
12 => 'двенадцать' ,
13 => 'тринадцать' ,
14 => 'четырнадцать' ,
15 => 'пятнадцать' ,
16 => 'шестнадцать' ,
17 => 'семнадцать' ,
18 => 'восемнадцать' ,
19 => 'девятнадцать' ,
20 => 'двадцать' ,
30 => 'тридцать' ,
40 => 'сорок' ,
50 => 'пятьдесят' ,
60 => 'шестьдесят' ,
70 => 'семьдесят' ,
80 => 'восемьдесят' ,
90 => 'девяносто' ,
100 => 'сто' ,
200 => 'двести' ,
300 => 'триста' ,
400 => 'четыреста' ,
500 => 'пятьсот' ,
600 => 'шестьсот' ,
700 => 'семьсот' ,
800 => 'восемьсот' ,
900 => 'девятьсот' ,
) ;
1000
=> array ( 'тысяча' , 'тысячи' , 'тысяч' , '' , 'sem' => 1
) , 1000000
=> array ( 'миллион' , 'миллиона' , 'миллионов' , '' , 'sem' => 0
) , 1000000000
=> array ( 'миллиард' , 'миллиарда' , 'миллиардов' , '' , 'sem' => 0
) ) ;
function semantic( $num , $words )
{
$des = false ;
$num = $num % 100 ;
if ( $num > 20 )
{
$num = $num % 10 ;
if ( ! $num ) {
$des = true ;
}
}
if ( 1 == $num ) {
return $words [ 0] ;
} elseif ( $des ) {
return $words [ 2] ;
} elseif ( ! $num ) {
return $words [ 3] ;
} elseif ( $num <= 4 ) {
return $words [ 1] ;
} else {
return $words [ 2] ;
}
}
function small_nums( $num , $sem )
{
if ( $num < 21 )
{
if ( $num <= 2 )
{
$this -> out [ ] = $this -> nums [ $num ] [ $sem ] ;
} else {
$this -> out [ ] = $this -> nums [ $num ] ;
}
} else {
$this -> out [ ] = $this -> nums [ $num - ( $num % 10 ) ] ;
if ( ( $num % 10 ) <= 2 )
{
$this -> out [ ] = $this -> nums [ $num % 10] [ $sem ] ;
} else {
$this -> out [ ] = $this -> nums [ $num % 10] ;
}
}
}
function work( $num , $all_sem )
{
foreach ( array ( 1000000000
, 1000000
, 1000
) as $order ) {
$temp = floor ( $num / $order ) ; if ( ( $temp - ( $temp % 100 ) ) > 0 ) {
$this -> out [ ] = $this -> nums [ $temp - ( $temp % 100 ) ] ;
}
$this -> small_nums ( $temp % 100, $this -> names [ $order ] [ 'sem' ] ) ;
$this -> out [ ] = $this -> semantic ( $temp , $this -> names [ $order ] ) ;
$num -= $temp * $order ;
}
$temp = $num ;
if ( ( $temp - ( $temp % 100 ) ) > 0 ) {
$this -> out [ ] = $this -> nums [ $temp - ( $temp % 100 ) ] ;
}
$this -> small_nums ( $temp % 100, $all_sem ) ;
$temp = implode ( ' ' , $this -> out ) ; return $temp ;
}
}
class money2str
{
1
=> array ( 'рубль' , 'рубля' , 'рублей' , 'рублей' , 'sem' => 0
) , 2
=> array ( 'копейка' , 'копейки' , 'копеек' , 'копеек' , 'sem' => 1
) ) ;
function money2str( )
{
$this -> num2str = new num2str( ) ;
}
function work( $money , $kopnum = false )
{
$rub = substr ( $money , 0
, - 3
) ; if ( ! $rub )
{
$this -> out [ ] = 'ноль' ;
} else {
$this -> out [ ] = $this -> num2str -> work ( $rub , $this -> names [ 1 ] [ 'sem' ] ) ;
}
$this -> out [ ] = $this -> num2str -> semantic ( $rub , $this -> names [ 1] ) ;
if ( ! $kopnum )
{
if ( ! $kop )
{
$this -> out [ ] = 'ноль' ;
} else {
$this -> out [ ] = $this -> num2str -> work ( $kop , $this -> names [ 2 ] [ 'sem' ] ) ;
}
} else {
$this -> out [ ] = $kop ;
}
$this -> out [ ] = $this -> num2str -> semantic ( $kop , $this -> names [ 2] ) ;
$temp = implode ( ' ' , $this -> out ) ; return $temp ;
}
}
?>
<?PHP
$name = fsch_name;
$KPP = fsch_KPP;
$INN = fsch_INN;
$Rch = fsch_Rch;
$Rch_v = fsch_Rch_v;
$BIK = fsch_BIK;
$Kch = fsch_Kch;
$IND = fsch_IND;
$obl = fsch_obl;
$gor = fsch_gor;
$ul = fsch_ul;
$dom = fsch_dom;
$office = fsch_office;
$tel = fsch_tel;
$fax = fsch_fax;
$url_img = fsch_url;
$width_img = fsch_width;
$height_img = fsch_height;
?>
<script>
function Load2(){
text = document.getElementById('result2').innerHTML;
printwin = open('', 'printwin', 'width=600,height=800');
printwin.document.open();
printwin.document.writeln('<html><head><title></title></head><body onload=print();close()>');
printwin.document.writeln(text);
printwin.document.writeln('</body></html>');
printwin.document.close();
}
</script>
<table width="560px" border="0" cellspacing="0" cellpadding="0" id=result2>
<tr>
<td><table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" rowspan="2" valign="top" style="border-bottom:none;">
<p style="font-size:12px; padding:2px;"> <?PHP echo $Rch_v ; ?> </p></td>
<td><p style="font-size:12px; padding:2px;">БИК</p></td>
<td><p style="font-size:12px; padding:2px;"><?PHP echo $BIK ; ?> </p></td>
</tr>
<tr>
<td style="border-bottom:none;"><p style="font-size:12px; padding:2px;">Сч. №</p></td>
<td style="border-bottom:none;"><p style="font-size:12px; padding:2px;"><?PHP echo $Kch ; ?> </p></td>
</tr>
<tr>
<td colspan="2" style="border-top:none;"><p style="font-size:10px; padding:2px;">Банк получателя</p></td>
<td style="border-top:none;"> </td>
<td style="border-top:none;"> </td>
</tr>
<tr>
<td><p style="font-size:12px; padding:2px;">ИНН <?PHP echo $INN ; ?> </p></td>
<td><p style="font-size:12px; padding:2px;">КПП <?PHP echo $KPP ; ?> </p></td>
<td rowspan="3" valign="top"><p style="font-size:12px; padding:2px;">Сч. №</p></td>
<td rowspan="3" valign="top"><p style="font-size:12px; padding:2px;"><?PHP echo $Rch ; ?> </p></td>
</tr>
<tr>
<td colspan="2" style="border-bottom:none;"><p style="font-size:12px; padding:2px;"><?PHP echo $name ; ?> </p></td>
</tr>
<tr>
<td colspan="2" style="border-top:none;"><p style="font-size:10px; padding:2px;">Получатель</p></td>
</tr>
</table></td>
</tr>
<tr>
<td>
<table height="40" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="border-bottom:2px solid #000000;"><p style="font-size:16px;"><strong>Счет на оплату №
<?PHP printf ( "%04d " , $db -> f ( "order_id" ) ) ; ?> от
<?PHP echo vmFormatDate
( $db -> f ( "cdate" ) , "%d .%m.%Y" ) ; ?> г.</strong></p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><p style="font-size:12px;">Поставщик:</p></td>
<td><p style="font-size:12px;"><strong>
<?PHP if ( $INN != "" ) echo "ИНН $INN ," ; ?>
<?PHP if ( $KPP != "" ) echo "КПП $KPP ," ; ?>
<?PHP if ( $name != "" ) echo "$name ," ; ?>
<?PHP if ( $IND != "" ) echo "$IND ," ; ?>
<?PHP if ( $obl != "" ) echo "$obl ," ; ?> <br>
<?PHP if ( $gor != "" ) echo "$gor ," ; ?>
<?PHP if ( $ul != "" ) echo "$ul ," ; ?>
<?PHP if ( $dom != "" ) echo "$dom ," ; ?>
<?PHP if ( $office != "" ) echo "$office ," ; ?> <br>
<?PHP if ( $tel != "" ) echo "тел.: $tel " ; ?>
<?PHP if ( $fax != "" ) echo ", факс: $fax " ; ?>
</strong></p></td>
</tr>
<tr>
<td width="80" align="center"><p style="font-size:12px;">Покупатель:</p></td>
<td><p style="font-size:12px;"><strong>
<?PHP $INN_P = $dbbt -> f ( "vm_inn" ) ; if ( $INN_P != "" ) echo "ИНН $INN_P ," ; ?>
<?PHP $KPP_P = $dbbt -> f ( "vm_kpp" ) ; if ( $KPP_P != "" ) echo "КПП $KPP_P ," ; ?>
<?PHP $company = $dbbt -> f ( "company" ) ; if ( $company != "" ) echo "$company ," ; ?>
<?PHP $zip = $dbbt -> f ( "zip" ) ; if ( $zip != "" ) echo "$zip ," ; ?>
<?PHP $vm_state = $dbbt -> f ( "vm_state" ) ; if ( $vm_state != "" ) echo "$vm_state ," ; ?> <br>
<?PHP $city = $dbbt -> f ( "city" ) ; if ( $city != "" ) echo "$city ," ; ?>
<?PHP $address_1 = $dbbt -> f ( "address_1" ) ; if ( $address_1 != "" ) echo "$address_1 ," ; ?>
<?PHP $address_2 = $dbbt -> f ( "address_2" ) ; if ( $address_2 != "" ) echo "$address_2 ," ; ?>
<?PHP $office_P = $dbbt -> f ( "vm_office" ) ; if ( $office_P != "" ) echo "$office_P ," ; ?>
<?PHP $phone = $dbbt -> f ( "phone_1" ) ; if ( $phone != "" ) echo "тел.: $phone " ; ?>
<br>Контактное лицо:
<?PHP echo $dbbt -> f ( "last_name" ) ; ?>
<?PHP echo $dbbt -> f ( "first_name" ) ; ?>
<?PHP echo $dbbt -> f ( "middle_name" ) ; ?>
</strong></p>
</td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><p style="font-size:12px;"><strong>№</strong></p></td>
<td align="center"><p style="font-size:12px;"><strong>Товары (услуги, работы)</strong></p></td>
<td align="center"><p style="font-size:12px;"><strong>Кол-во</strong></p></td>
<td align="center"><p style="font-size:12px;"><strong>Ед.</strong></p></td>
<td align="center"><p style="font-size:12px;"><strong>Цена</strong></p></td>
<td align="center"><p style="font-size:12px;"><strong>Сумма</strong></p></td>
</tr>
<?PHP
$dbcart = new ps_DB;
$q = "SELECT * FROM #__vm_order_item " ;
$q .= "WHERE #__vm_order_item.order_id='$order_id ' " ;
$dbcart -> query ( $q ) ;
$subtotal = 0 ;
$dbi = new ps_DB;
$dbdel = new ps_DB;
while ( $dbcart -> next_record ( ) ) {
?>
<tr>
<td align="center"><?PHP $nomer = $nomer + 1 ; echo $nomer ; ?> </td>
<td>
<p style="font-size:12px; line-height:12px; margin:0px; padding:0px; padding-left:2px; padding-right:2px;">
<?PHP $dbcart -> p ( "order_item_name" ) ; ?> </p>
<p style="font-size:10px; line-height:11px; margin:0px; padding:0px; padding-left:10px;">
<?PHP echo $dbcart -> f ( "product_attribute" ) ; ?> </p>
</td>
<td align="right"><p style="font-size:11px; padding-right:5px;">
<?PHP $dbcart -> p ( "product_quantity" ) ; ?> </p></td>
<td align="center">шт.</td>
<td align="right"><p style="font-size:11px; padding-right:5px;">
<?PHP if ( $auth [ "show_price_including_tax" ] ) {
$item_price = $dbcart -> f ( "product_final_price" ) ;
}
else {
$item_price = $dbcart -> f ( "product_item_price" ) ;
}
$cena2 = $dbcart -> f ( "product_final_price" ) ;
?> </p></td>
<td align="right"><p style="font-size:11px; padding-right:5px;">
<?PHP $total = $dbcart -> f ( "product_quantity" ) * $item_price ; echo number_format ( $total , 2 , '.' , ' ' ) ; ?> </p>
</td>
</tr><?PHP } ?>
<?PHP $details = explode ( "|" , $db -> f ( "ship_method_id" ) ) ; $dostavka = $details [ 3] ;
if ( $dostavka != 0 ) {
?>
<tr>
<td align="center"><?PHP $nomer = $nomer + 1 ; echo $nomer ; ?> </td>
<td><p style="font-size:12px; padding-left:2px;">Вариант доставки:<br>
<?PHP echo $details [ 1] ; ?> </p></td>
<td> </td>
<td> </td>
<td align="right"><p style="font-size:12px; padding-right:5px;">
<?PHP echo number_format ( $dostavka , 2 , '.' , ' ' ) ; ?> </p></td>
<td align="right"><p style="font-size:12px; padding-right:5px;">
<?PHP echo number_format ( $dostavka , 2 , '.' , ' ' ) ; ?> </p></td>
</tr>
<?PHP } ?>
</table></td>
</tr>
<tr>
<td>
<table width="100%" height="50" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100"> </td>
<td width="360" height="20" align="right" valign="bottom">
<p style="font-size:12px; padding-right:5px;"><strong>Итого:</strong></p></td>
<td width="100" align="right" valign="bottom">
<p style="font-size:12px; padding-right:5px;"><strong><?PHP $total_sum = $db -> f ( "order_total" ) ;
</td>
</tr>
<tr>
<td> </td>
<td height="20" align="right">
<p style="font-size:12px; padding-right:5px;">В том числе НДС:</p></td>
<td align="right">
<p style="font-size:12px; padding-right:5px;">
<?PHP $tax_total = $db -> f ( "order_tax" ) + $db -> f ( "order_shipping_tax" ) ; echo number_format ( $tax_total , 2 , '.' , ' ' ) ; ?> </p></td>
</tr>
<tr>
<td> </td>
<td height="20" align="right">
<p style="font-size:12px; padding-right:5px;">Без налога (НДС):</p></td>
<td align="right">
<p style="font-size:12px; padding-right:5px;">
<?PHP $summa_bez_nalogov = $total_sum - $tax_total ;
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="40" style="border-bottom:2px solid #000000;">
<p style="font-size:12px; padding-left:10px;">Всего наименований <strong>
<?PHP echo $nomer ; ?> </strong>, на сумму <strong>
<?PHP echo number_format ( $total_sum , 2 , '.' , ' ' ) ; ?> руб.<br>
<?PHP
$m = new money2str( ) ;
echo $m -> work ( $total_sum , true ) ;
?>
</strong></p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center">
<img src="<?PHP echo $url_img ; ?> " width="<?PHP echo $width_img ; ?> " height="<?PHP echo $height_img ; ?> ">
</td>
</tr>
</table>
<br>
<input type=submit onclick=Load2() value="Распечатать счет">
Отредактировано модератором: Мелкий, 16 Ноября, 2011 - 20:24:29
serdr
Отправлено: 16 Ноября, 2011 - 19:04:16
Новичок
Покинул форум
Сообщений всего: 4
Дата рег-ции: Нояб. 2011
Помог: 0 раз(а)
DeepVarvar пишет: Номера строк высчитывать самим? Оформите код тегами...
а как автоматом поставить в проге php expert editor номера строк?
(Добавление)
если только так, где смайлики
-------------------------------- ------------------------ сам код
PHP:
скопировать код в буфер обмена
<?PHP
/*
Модуль оплаты для VirtueMart 1.1.x / Joomla 1.5.x.
Содержит форму счет, стандартного вида, для оплаты между юр. лицами.
Автор модуля: программисты ecomsite
Сайт поддержки http://ecomsite.ru
Управляющие файлы: ps_fsch.php и ps_fsch.cfg.php
Распространяется по лицензии GNU/GPL
*/
?>
<?PHP class num2str
{
1
=> array ( 'один' , 'одна' ) , 2
=> array ( 'два' , 'две' ) , 3 => 'три' ,
4 => 'четыре' ,
5 => 'пять' ,
6 => 'шесть' ,
7 => 'семь' ,
8 => 'восемь' ,
9 => 'девять' ,
10 => 'десять' ,
11 => 'одиннадцать' ,
12 => 'двенадцать' ,
13 => 'тринадцать' ,
14 => 'четырнадцать' ,
15 => 'пятнадцать' ,
16 => 'шестнадцать' ,
17 => 'семнадцать' ,
18 => 'восемнадцать' ,
19 => 'девятнадцать' ,
20 => 'двадцать' ,
30 => 'тридцать' ,
40 => 'сорок' ,
50 => 'пятьдесят' ,
60 => 'шестьдесят' ,
70 => 'семьдесят' ,
80 => 'восемьдесят' ,
90 => 'девяносто' ,
100 => 'сто' ,
200 => 'двести' ,
300 => 'триста' ,
400 => 'четыреста' ,
500 => 'пятьсот' ,
600 => 'шестьсот' ,
700 => 'семьсот' ,
800 => 'восемьсот' ,
900 => 'девятьсот' ,
) ;
1000
=> array ( 'тысяча' , 'тысячи' , 'тысяч' , '' , 'sem' => 1
) , 1000000
=> array ( 'миллион' , 'миллиона' , 'миллионов' , '' , 'sem' => 0
) , 1000000000
=> array ( 'миллиард' , 'миллиарда' , 'миллиардов' , '' , 'sem' => 0
) ) ;
function semantic( $num , $words )
{
$des = false ;
$num = $num % 100 ;
if ( $num > 20 )
{
$num = $num % 10 ;
if ( ! $num ) {
$des = true ;
}
}
if ( 1 == $num ) {
return $words [ 0] ;
} elseif ( $des ) {
return $words [ 2] ;
} elseif ( ! $num ) {
return $words [ 3] ;
} elseif ( $num <= 4 ) {
return $words [ 1] ;
} else {
return $words [ 2] ;
}
}
function small_nums( $num , $sem )
{
if ( $num < 21 )
{
if ( $num <= 2 )
{
$this -> out [ ] = $this -> nums [ $num ] [ $sem ] ;
} else {
$this -> out [ ] = $this -> nums [ $num ] ;
}
} else {
$this -> out [ ] = $this -> nums [ $num - ( $num % 10 ) ] ;
if ( ( $num % 10 ) <= 2 )
{
$this -> out [ ] = $this -> nums [ $num % 10] [ $sem ] ;
} else {
$this -> out [ ] = $this -> nums [ $num % 10] ;
}
}
}
function work( $num , $all_sem )
{
foreach ( array ( 1000000000
, 1000000
, 1000
) as $order ) {
$temp = floor ( $num / $order ) ; if ( ( $temp - ( $temp % 100 ) ) > 0 ) {
$this -> out [ ] = $this -> nums [ $temp - ( $temp % 100 ) ] ;
}
$this -> small_nums ( $temp % 100, $this -> names [ $order ] [ 'sem' ] ) ;
$this -> out [ ] = $this -> semantic ( $temp , $this -> names [ $order ] ) ;
$num -= $temp * $order ;
}
$temp = $num ;
if ( ( $temp - ( $temp % 100 ) ) > 0 ) {
$this -> out [ ] = $this -> nums [ $temp - ( $temp % 100 ) ] ;
}
$this -> small_nums ( $temp % 100, $all_sem ) ;
$temp = implode ( ' ' , $this -> out ) ; return $temp ;
}
}
class money2str
{
1
=> array ( 'рубль' , 'рубля' , 'рублей' , 'рублей' , 'sem' => 0
) , 2
=> array ( 'копейка' , 'копейки' , 'копеек' , 'копеек' , 'sem' => 1
) ) ;
function money2str( )
{
$this -> num2str = new num2str( ) ;
}
function work( $money , $kopnum = false )
{
$rub = substr ( $money , 0
, - 3
) ; if ( ! $rub )
{
$this -> out [ ] = 'ноль' ;
} else {
$this -> out [ ] = $this -> num2str -> work ( $rub , $this -> names [ 1 ] [ 'sem' ] ) ;
}
$this -> out [ ] = $this -> num2str -> semantic ( $rub , $this -> names [ 1] ) ;
if ( ! $kopnum )
{
if ( ! $kop )
{
$this -> out [ ] = 'ноль' ;
} else {
$this -> out [ ] = $this -> num2str -> work ( $kop , $this -> names [ 2 ] [ 'sem' ] ) ;
}
} else {
$this -> out [ ] = $kop ;
}
$this -> out [ ] = $this -> num2str -> semantic ( $kop , $this -> names [ 2] ) ;
$temp = implode ( ' ' , $this -> out ) ; return $temp ;
}
}
?>
<?PHP
$name = fsch_name;
$KPP = fsch_KPP;
$INN = fsch_INN;
$Rch = fsch_Rch;
$Rch_v = fsch_Rch_v;
$BIK = fsch_BIK;
$Kch = fsch_Kch;
$IND = fsch_IND;
$obl = fsch_obl;
$gor = fsch_gor;
$ul = fsch_ul;
$dom = fsch_dom;
$office = fsch_office;
$tel = fsch_tel;
$fax = fsch_fax;
$url_img = fsch_url;
$width_img = fsch_width;
$height_img = fsch_height;
?>
<script>
function Load2(){
text = document.getElementById('result2').innerHTML;
printwin = open('', 'printwin', 'width=600,height=800');
printwin.document.open();
printwin.document.writeln('<html><head><title></title></head><body onload=print();close()>');
printwin.document.writeln(text);
printwin.document.writeln('</body></html>');
printwin.document.close();
}
</script>
<table width="560px" border="0" cellspacing="0" cellpadding="0" id=result2>
<tr>
<td><table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" rowspan="2" valign="top" style="border-bottom:none;">
<p style="font-size:12px; padding:2px;"> <?PHP echo $Rch_v ; ?> </p></td>
<td><p style="font-size:12px; padding:2px;">БИК</p></td>
<td><p style="font-size:12px; padding:2px;"><?PHP echo $BIK ; ?> </p></td>
</tr>
<tr>
<td style="border-bottom:none;"><p style="font-size:12px; padding:2px;">Сч. №</p></td>
<td style="border-bottom:none;"><p style="font-size:12px; padding:2px;"><?PHP echo $Kch ; ?> </p></td>
</tr>
<tr>
<td colspan="2" style="border-top:none;"><p style="font-size:10px; padding:2px;">Банк получателя</p></td>
<td style="border-top:none;"> </td>
<td style="border-top:none;"> </td>
</tr>
<tr>
<td><p style="font-size:12px; padding:2px;">ИНН <?PHP echo $INN ; ?> </p></td>
<td><p style="font-size:12px; padding:2px;">КПП <?PHP echo $KPP ; ?> </p></td>
<td rowspan="3" valign="top"><p style="font-size:12px; padding:2px;">Сч. №</p></td>
<td rowspan="3" valign="top"><p style="font-size:12px; padding:2px;"><?PHP echo $Rch ; ?> </p></td>
</tr>
<tr>
<td colspan="2" style="border-bottom:none;"><p style="font-size:12px; padding:2px;"><?PHP echo $name ; ?> </p></td>
</tr>
<tr>
<td colspan="2" style="border-top:none;"><p style="font-size:10px; padding:2px;">Получатель</p></td>
</tr>
</table></td>
</tr>
<tr>
<td>
<table height="40" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="border-bottom:2px solid #000000;"><p style="font-size:16px;"><strong>Счет на оплату №
<?PHP printf ( "%04d " , $db -> f ( "order_id" ) ) ; ?> от
<?PHP echo vmFormatDate
( $db -> f ( "cdate" ) , "%d .%m.%Y" ) ; ?> г.</strong></p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><p style="font-size:12px;">Поставщик:</p></td>
<td><p style="font-size:12px;"><strong>
<?PHP if ( $INN != "" ) echo "ИНН $INN ," ; ?>
<?PHP if ( $KPP != "" ) echo "КПП $KPP ," ; ?>
<?PHP if ( $name != "" ) echo "$name ," ; ?>
<?PHP if ( $IND != "" ) echo "$IND ," ; ?>
<?PHP if ( $obl != "" ) echo "$obl ," ; ?> <br>
<?PHP if ( $gor != "" ) echo "$gor ," ; ?>
<?PHP if ( $ul != "" ) echo "$ul ," ; ?>
<?PHP if ( $dom != "" ) echo "$dom ," ; ?>
<?PHP if ( $office != "" ) echo "$office ," ; ?> <br>
<?PHP if ( $tel != "" ) echo "тел.: $tel " ; ?>
<?PHP if ( $fax != "" ) echo ", факс: $fax " ; ?>
</strong></p></td>
</tr>
<tr>
<td width="80" align="center"><p style="font-size:12px;">Покупатель:</p></td>
<td><p style="font-size:12px;"><strong>
<?PHP $INN_P = $dbbt -> f ( "vm_inn" ) ; if ( $INN_P != "" ) echo "ИНН $INN_P ," ; ?>
<?PHP $KPP_P = $dbbt -> f ( "vm_kpp" ) ; if ( $KPP_P != "" ) echo "КПП $KPP_P ," ; ?>
<?PHP $company = $dbbt -> f ( "company" ) ; if ( $company != "" ) echo "$company ," ; ?>
<?PHP $zip = $dbbt -> f ( "zip" ) ; if ( $zip != "" ) echo "$zip ," ; ?>
<?PHP $vm_state = $dbbt -> f ( "vm_state" ) ; if ( $vm_state != "" ) echo "$vm_state ," ; ?> <br>
<?PHP $city = $dbbt -> f ( "city" ) ; if ( $city != "" ) echo "$city ," ; ?>
<?PHP $address_1 = $dbbt -> f ( "address_1" ) ; if ( $address_1 != "" ) echo "$address_1 ," ; ?>
<?PHP $address_2 = $dbbt -> f ( "address_2" ) ; if ( $address_2 != "" ) echo "$address_2 ," ; ?>
<?PHP $office_P = $dbbt -> f ( "vm_office" ) ; if ( $office_P != "" ) echo "$office_P ," ; ?>
<?PHP $phone = $dbbt -> f ( "phone_1" ) ; if ( $phone != "" ) echo "тел.: $phone " ; ?>
<br>Контактное лицо:
<?PHP echo $dbbt -> f ( "last_name" ) ; ?>
<?PHP echo $dbbt -> f ( "first_name" ) ; ?>
<?PHP echo $dbbt -> f ( "middle_name" ) ; ?>
</strong></p>
</td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><p style="font-size:12px;"><strong>№</strong></p></td>
<td align="center"><p style="font-size:12px;"><strong>Товары (услуги, работы)</strong></p></td>
<td align="center"><p style="font-size:12px;"><strong>Кол-во</strong></p></td>
<td align="center"><p style="font-size:12px;"><strong>Ед.</strong></p></td>
<td align="center"><p style="font-size:12px;"><strong>Цена</strong></p></td>
<td align="center"><p style="font-size:12px;"><strong>Сумма</strong></p></td>
</tr>
<?PHP
$dbcart = new ps_DB;
$q = "SELECT * FROM #__vm_order_item " ;
$q .= "WHERE #__vm_order_item.order_id='$order_id ' " ;
$dbcart -> query ( $q ) ;
$subtotal = 0 ;
$dbi = new ps_DB;
$dbdel = new ps_DB;
while ( $dbcart -> next_record ( ) ) {
?>
<tr>
<td align="center"><?PHP $nomer = $nomer + 1 ; echo $nomer ; ?> </td>
<td>
<p style="font-size:12px; line-height:12px; margin:0px; padding:0px; padding-left:2px; padding-right:2px;">
<?PHP $dbcart -> p ( "order_item_name" ) ; ?> </p>
<p style="font-size:10px; line-height:11px; margin:0px; padding:0px; padding-left:10px;">
<?PHP echo $dbcart -> f ( "product_attribute" ) ; ?> </p>
</td>
<td align="right"><p style="font-size:11px; padding-right:5px;">
<?PHP $dbcart -> p ( "product_quantity" ) ; ?> </p></td>
<td align="center">шт.</td>
<td align="right"><p style="font-size:11px; padding-right:5px;">
<?PHP if ( $auth [ "show_price_including_tax" ] ) {
$item_price = $dbcart -> f ( "product_final_price" ) ;
}
else {
$item_price = $dbcart -> f ( "product_item_price" ) ;
}
$cena2 = $dbcart -> f ( "product_final_price" ) ;
?> </p></td>
<td align="right"><p style="font-size:11px; padding-right:5px;">
<?PHP $total = $dbcart -> f ( "product_quantity" ) * $item_price ; echo number_format ( $total , 2 , '.' , ' ' ) ; ?> </p>
</td>
</tr><?PHP } ?>
<?PHP $details = explode ( "|" , $db -> f ( "ship_method_id" ) ) ; $dostavka = $details [ 3] ;
if ( $dostavka != 0 ) {
?>
<tr>
<td align="center"><?PHP $nomer = $nomer + 1 ; echo $nomer ; ?> </td>
<td><p style="font-size:12px; padding-left:2px;">Вариант доставки:<br>
<?PHP echo $details [ 1] ; ?> </p></td>
<td> </td>
<td> </td>
<td align="right"><p style="font-size:12px; padding-right:5px;">
<?PHP echo number_format ( $dostavka , 2 , '.' , ' ' ) ; ?> </p></td>
<td align="right"><p style="font-size:12px; padding-right:5px;">
<?PHP echo number_format ( $dostavka , 2 , '.' , ' ' ) ; ?> </p></td>
</tr>
<?PHP } ?>
</table></td>
</tr>
<tr>
<td>
<table width="100%" height="50" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100"> </td>
<td width="360" height="20" align="right" valign="bottom">
<p style="font-size:12px; padding-right:5px;"><strong>Итого:</strong></p></td>
<td width="100" align="right" valign="bottom">
<p style="font-size:12px; padding-right:5px;"><strong><?PHP $total_sum = $db -> f ( "order_total" ) ;
</td>
</tr>
<tr>
<td> </td>
<td height="20" align="right">
<p style="font-size:12px; padding-right:5px;">В том числе НДС:</p></td>
<td align="right">
<p style="font-size:12px; padding-right:5px;">
<?PHP $tax_total = $db -> f ( "order_tax" ) + $db -> f ( "order_shipping_tax" ) ; echo number_format ( $tax_total , 2 , '.' , ' ' ) ; ?> </p></td>
</tr>
<tr>
<td> </td>
<td height="20" align="right">
<p style="font-size:12px; padding-right:5px;">Без налога (НДС):</p></td>
<td align="right">
<p style="font-size:12px; padding-right:5px;">
<?PHP $summa_bez_nalogov = $total_sum - $tax_total ;
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="40" style="border-bottom:2px solid #000000;">
<p style="font-size:12px; padding-left:10px;">Всего наименований <strong>
<?PHP echo $nomer ; ?> </strong>, на сумму <strong>
<?PHP echo number_format ( $total_sum , 2 , '.' , ' ' ) ; ?> руб.<br>
<?PHP
$m = new money2str( ) ;
echo $m -> work ( $total_sum , true ) ;
?>
</strong></p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center">
<img src="<?PHP echo $url_img ; ?> " width="<?PHP echo $width_img ; ?> " height="<?PHP echo $height_img ; ?> ">
</td>
</tr>
</table>
<br>
<input type=submit onclick=Load2() value="Распечатать счет">
Отредактировано модератором: Мелкий, 16 Ноября, 2011 - 20:23:44 примерно так. смайлики не убирал =)
serdr
Отправлено: 16 Ноября, 2011 - 19:31:59
Новичок
Покинул форум
Сообщений всего: 4
Дата рег-ции: Нояб. 2011
Помог: 0 раз(а)
DeepVarvar пишет:
PHP:
скопировать код в буфер обмена
1.
<?PHP
2.
echo "это форматированый код!!!";
3.
?>
самый верхний нет
(Отредактировано автором: 16 Ноября, 2011 - 19:32:17)
Поиск в теме | Версия для печати
Страниц (1): [1]
Сейчас эту тему просматривают: 0 (гостей: 0, зарегистрированных: 0)
« Если скрипт не работает »
Все гости форума могут просматривать этот раздел. Только зарегистрированные пользователи могут создавать новые темы в этом разделе. Только зарегистрированные пользователи могут отвечать на сообщения в этом разделе.
Powered by ExBB FM 1.0 RC1. InvisionExBB