Exemplo n.º 1
0
 /**
  * @return string
  * @desc Cat mot string ngan lai de vua mot cot nho
  */
 function trunstrword($str, $trunsize = 0)
 {
     $size = $trunsize ? $trunsize : 20;
     if (strlen($str) <= $size) {
         return $str;
     }
     $len = strlen($str);
     for ($r = VNCode::indexUTF8($str, $size); $r < $len && $str[$r] != ' ' && $r < $size + 10; $r++) {
     }
     $s2 = substr($str, 0, $r);
     if (strlen($s2) < strlen($str)) {
         $s2 .= '...';
     }
     return $s2;
 }
$vr2 = $this->hdvao ? 'baùn' : 'mua';
$html = '
<table width=' . $p->width . ' align=center>
<tr bgcolor=#eeeeee repeat=1>
<td align=center border=1111 rowspan=2 width=1>S<br>T<br>T
<td align=center border=1110 colspan=3>Hoùa ñôn chöùng töø ' . $vr1 . '
<td align=center border=1110 rowspan=2 width=50>Teân ngöôøi ' . $vr2 . '
<td align=center border=1110 rowspan=2>Maõ soá thueá
<td align=center border=1110 rowspan=2 width=50>Maët haøng
<td align=center border=1110 rowspan=2>Doanh soá ' . $vr1 . ' chöa coù thueá
<td align=center border=1110 rowspan=2 nowrap>Thueá<br>suaát
<td align=center border=1110 rowspan=2>Thueá GTGT
<td align=center border=1110 rowspan=2 width=10>Ghi chuù
<tr bgcolor=#eeeeee repeat=1>
<td align=center border=0110>Kyù hieäu
<td align=center border=0110>Soá hoùa ñôn
<td align=center border=0110>Ngaøy phaùt haønh
';
$q = new DB("SELECT * FROM {$this->temptable}");
$stt = 1;
//Seri, Code, Publish, B.Name,TaxCode,Good, C.Total, TaxRatio, Tax
while ($r = $q->getRowField()) {
    $html .= '<tr>' . '<td align=center border=0111 nowrap>' . $stt . '<td align=center border=0110 nowrap>' . $r['Seri'] . '<td align=center border=0110 nowrap>' . $r['Code'] . '<td align=center border=0110 nowrap>' . date2html($r['Publish']) . '<td border=0110>' . VNCode::UTF8VNI($r['Name']) . '<td align=center border=0110 nowrap>' . $r['TaxCode'] . '<td border=0110>' . VNCode::UTF8VNI($r['Good']) . '<td align=right border=0110 nowrap>' . so2pc($r['Total']) . '<td align=center border=0110 nowrap>' . $r['TaxRatio'] . '<td align=right border=0110 nowrap>' . so2pc($r['Tax']) . '<td border=0110 width=20>&nbsp;';
    $stt++;
}
$p->htmltable($html);
$p->Ln(3);
$time = strftime('Ngaøy %d thaùng %m naêm %Y');
$html = "<table width={$p->width}>\n<tr><td align=center valign=top height=40>&nbsp;<br>NGÖÔØI LAÄP BAÛNG<br>(Kyù vaø ghi roõ hoï teân)<td align=center valign=top>{$time}<br>GIAÙM ÑOÁC<br>(Kyù vaø ghi roõ hoï teân)\n";
$p->htmltable($html);
$p->download('bkhd' . ($this->hdvao ? 'vao' : 'ra'));