Faturada yazdırma ekranında düzenleme
5
●348
- 20-08-2016, 11:22:12Yazdığımız bir ön muhasebe otomastonu için çok fazla uğraştırmıştı. Özellikle boyut hesaplamaları çok sıkıntılı. Anlaşacağınız arkadaş aşağıdaki kod betiğine yalnızca fatura detaylarını işlerse sıkıntısız çıktı alabilirsiniz.
Not: nokta vuruşlu yazıcılarda içerisindeki boyutlar doğru görünmez ve karakter yazımları hatalı gelir. Normal yazıcılar ile yazılmalıdır.
MPDF ile çıktı alınmakta.
<?php header('Content-type: text/html; charset=utf-8'); include(CLASSLAR."/MPDF57/mpdf.php"); $mpdf=new mPDF('utf-8','A4-L','8','Arial' , 0 , 0 , 1 , 0 , 0 , 0); $html = ' <div style="width:372px; float:left;"> <div style="width:352px; float:left;"> <div style="width:63px; line-height:10px; float:right; text-align:left;"> '.str_replace('.','/',$fatura->tarih).'<br> '.$fatura->sevktarihi.' <br> '.$fatura->irsaliyeno.' </div> </div> <div style="width:352px; margin-top:40px; float:left;"> <div style="width:162px; margin-left:8px; float:left;"> '.$isim.'<br> '.$adres.' '.$telefon.' </div> <div style="width:162px; margin-left:20px; float:left;"> '.$isim.'<br> '.$adres.' '.$telefon.'<br> '.$vergidairesi.' '.$vergino.' </div> </div> <div style="width:352px; height:350px; margin-top:70px; float:left;"> '; $c = $db->results("select * from kalemler where fatura_id='$get->id'"); foreach($c as $q){ $toplamtutar = $toplamtutar + $q->nettutar; if(count($q) < 1){ echo '<div class="controls-row"> <div class="span12">Eklenmiş ürün bulunmamaktadır.</div></div>'; exit;} if(!empty($q->urun_id)){ $urun = $db->row("select * from urunler where urunid='$q->urun_id'"); $html .= ' <div style="width:352px; float:left; height:15px;"> <div style="width:190px; margin-left:3px; height:20px; float:left;"> '.$urun->urunad.' - '.$q->sipariskodu.' </div> <div style="width:27px; text-align:center; float:left;"> 18 </div> <div style="width:40px; text-align:center; float:left;"> '.$q->adet.' </div> <div style="width:44px; text-align:right; float:left;"> '.$q->birimfiyat.' </div> <div style="width:48px;text-align:right; float:left;"> '.$q->nettutar.' </div> </div> '; } } $html .= '</div> <div style="width:342px; margin: 0 10px; height:40px; float:left;"> İşbu fatura tutarı "'.$cari->unvan.'" hesabına devredilmiştir. </div> <div style="width:181px; margin-left:15px; float:left; height:50px;"> YALNIZ:'.$sistem->buyukharf(trim($sistem->rakamtoyazi($fatura->toplamtutar))).' </div> <div style="width:91px; margin-left:50px; float:left; height:60px;"> <div style="width:50px; float:left; height:20px;">Ara Toplam</div> <div style="width:40px; float:left; height:20px; text-align:right;">'.$sistem->temizle($fatura->nettutar).'</div> <div style="width:50px; float:left; height:20px;">KDV (%18)</div> <div style="width:40px; float:left; height:20px; text-align:right;">'.$sistem->temizle($fatura->kdvtutar).'</div> <div style="width:50px; float:left; height:20px;">Genel Toplam</div> <div style="width:40px; float:left; height:20px; text-align:right;">'.$sistem->temizle($fatura->toplamtutar).'</div> </div> </div> '; ## 2. suret $html .= ' <div style="width:352px; padding-left:20px; float:left;"> <div style="width:352px; float:left;"> <div style="width:63px; line-height:10px; float:right; text-align:left;"> '.str_replace('.','/',$fatura->tarih).'<br> '.$fatura->sevktarihi.' <br> '.$fatura->irsaliyeno.' </div> </div> <div style="width:352px; margin-top:40px; float:left;"> <div style="width:162px; margin-left:8px; float:left;"> '.$isim.'<br> '.$adres.' '.$telefon.' </div> <div style="width:162px; margin-left:20px; float:left;"> '.$isim.'<br> '.$adres.' '.$telefon.'<br> '.$vergidairesi.' '.$vergino.' </div> </div> <div style="width:352px; height:350px; margin-top:70px; float:left;"> '; $c = $db->results("select * from kalemler where fatura_id='$get->id'"); foreach($c as $q){ $toplamtutar = $toplamtutar + $q->nettutar; if(count($q) < 1){ echo '<div class="controls-row"> <div class="span12">Eklenmiş ürün bulunmamaktadır.</div></div>'; exit;} if(!empty($q->urun_id)){ $urun = $db->row("select * from urunler where urunid='$q->urun_id'"); $html .= ' <div style="width:352px; float:left; height:15px;"> <div style="width:190px; margin-left:3px; height:20px; float:left;"> '.$urun->urunad.' - '.$q->sipariskodu.' </div> <div style="width:26px; text-align:center; float:left;"> 18 </div> <div style="width:40px; text-align:center; float:left;"> '.$q->adet.' </div> <div style="width:44px; text-align:right; float:left;"> '.$q->birimfiyat.' </div> <div style="width:48px;text-align:right; float:left;"> '.$q->nettutar.' </div> </div> '; } } $html .= '</div> <div style="width:342px; margin: 0 10px; height:40px; float:left;"> İşbu fatura tutarı "'.$cari->unvan.'" hesabına devredilmiştir. </div> <div style="width:181px; margin-left:15px; float:left; height:50px;"> YALNIZ:'.$sistem->buyukharf(trim($sistem->rakamtoyazi($fatura->toplamtutar))).' </div> <div style="width:91px; margin-left:50px; float:left; height:60px;"> <div style="width:50px; float:left; height:20px;">Ara Toplam</div> <div style="width:40px; float:left; height:20px; text-align:right;">'.$sistem->temizle($fatura->nettutar).'</div> <div style="width:50px; float:left; height:20px;">KDV (%18)</div> <div style="width:40px; float:left; height:20px; text-align:right;">'.$sistem->temizle($fatura->kdvtutar).'</div> <div style="width:50px; float:left; height:20px;">Genel Toplam</div> <div style="width:40px; float:left; height:20px; text-align:right;">'.$sistem->temizle($fatura->toplamtutar).'</div> </div> </div> '; ## 3.suret $html .= ' <div style="width:352px; padding-left:20px; float:left;"> <div style="width:352px; float:left;"> <div style="width:57px; line-height:10px; float:right; text-align:left;"> '.str_replace('.','/',$fatura->tarih).'<br> '.$fatura->sevktarihi.' <br> '.$fatura->irsaliyeno.' </div> </div> <div style="width:352px; margin-top:40px; float:left;"> <div style="width:162px; margin-left:8px; float:left;"> '.$isim.'<br> '.$adres.' '.$telefon.' </div> <div style="width:162px; margin-left:20px; float:left;"> '.$isim.'<br> '.$adres.' '.$telefon.'<br> '.$vergidairesi.' '.$vergino.' </div> </div> <div style="width:352px; height:350px; margin-top:70px; float:left;"> '; $c = $db->results("select * from kalemler where fatura_id='$get->id'"); foreach($c as $q){ $toplamtutar = $toplamtutar + $q->nettutar; if(count($q) < 1){ echo '<div class="controls-row"> <div class="span12">Eklenmiş ürün bulunmamaktadır.</div></div>'; exit;} if(!empty($q->urun_id)){ $urun = $db->row("select * from urunler where urunid='$q->urun_id'"); $html .= ' <div style="width:352px; float:left; height:15px;"> <div style="width:190px; margin-left:3px; height:20px; float:left;"> '.$urun->urunad.' - '.$q->sipariskodu.' </div> <div style="width:26px; text-align:center; float:left;"> 18 </div> <div style="width:40px; text-align:center; float:left;"> '.$q->adet.' </div> <div style="width:44px; text-align:right; float:left;"> '.$q->birimfiyat.' </div> <div style="width:48px;text-align:right; float:left;"> '.$q->nettutar.' </div> </div> '; } } $html .= '</div> <div style="width:342px; margin: 0 10px; height:40px; float:left;"> İşbu fatura tutarı "'.$cari->unvan.'" hesabına devredilmiştir. </div> <div style="width:181px; margin-left:15px; float:left; height:50px;"> YALNIZ:'.$sistem->buyukharf(trim($sistem->rakamtoyazi($fatura->toplamtutar))).' </div> <div style="width:91px; margin-left:50px; float:left; height:60px;"> <div style="width:50px; float:left; height:20px;">Ara Toplam</div> <div style="width:40px; float:left; height:20px; text-align:right;">'.$sistem->temizle($fatura->nettutar).'</div> <div style="width:50px; float:left; height:20px;">KDV (%18)</div> <div style="width:40px; float:left; height:20px; text-align:right;">'.$sistem->temizle($fatura->kdvtutar).'</div> <div style="width:50px; float:left; height:20px;">Genel Toplam</div> <div style="width:40px; float:left; height:20px; text-align:right;">'.$sistem->temizle($fatura->toplamtutar).'</div> </div> </div> '; $html = '<div style="width:1118px; padding-top:105px;margin-left:1px; height:650px; font-size:7px; float:left; ">'.$html.'</div>'; $mpdf->WriteHTML($html); $mpdf->Output(); ?> - 21-08-2016, 19:55:36Arayışınız devam ediyorsa mail atarsanız arkadaşlarımız yardımcı olacaklardır.TEKADAM adlı üyeden alıntı: mesajı görüntüle
