$a->SetFillColor(210, 210, 010);
 $a->Cell(10, 8, $n, 1, 0, 'C', true);
 $a->Cell(90, 8, $r->Nama != '' ? $r->Nama : 'PELANGGAN', 1, 0, 'L', true);
 $a->Cell(93, 8, $r->Catatan . " " . $r->Alamat . " " . $r->Kota, 1, 1, "L", true);
 $a->SetFont('Arial', '', 9);
 $ID_P = " and p.ID_Anggota='" . $r->ID_Anggota . "' group by dt.ID_Jual";
 $orderby .= ",p.Tanggal";
 //$a->Cell(193,8,$where.' '.$ID_P.' '.$orderby,1,1,'L',true);
 $dataz = $this->kasir_model->detail_trans_jual($where, $ID_P, $orderby);
 foreach ($dataz as $r2) {
     $nn++;
     $x = 0;
     $a->SetFont('Arial', 'I', 9);
     $a->SetFillColor(247, 240, 213);
     $a->Cell(10, 8, $nn, 1, 0, 'R', true);
     $a->cell(20, 8, tglfromSql($r2->Tanggal), 1, 0, 'C', true);
     $a->cell(20, 8, $r2->Nomor, 1, 0, 'C', true);
     $a->Cell(70, 8, $r2->ID_Jenis == '1' || $r2->ID_Jenis == '5' ? $r2->Jenis_Jual : $r2->Jenis_Jual . " : " . $r2->ID_Post . " - " . $r2->Deskripsi, 1, 0, "L", true);
     $a->Cell(73, 8, $r2->ID_Jenis == '1' || $r2->ID_Jenis == '5' ? "" : "Jatuh Tempo  Tanggal : " . tglfromSql($r2->Tgl_Cicilan), 1, 1, 'L', true);
     $a->SetFont('Arial', '', 9);
     $Grp = " and p.ID_Anggota='" . $r2->ID_Anggota . "' and dt.ID_Jual='" . $r2->ID_Jual . "'";
     $dataz = $this->kasir_model->detail_trans_jual($where, $Grp, $orderby);
     foreach ($dataz as $rr2) {
         $x++;
         $a->Row(array('', $x, $rr2->Kode, ucwords($rr2->Nama_Barang), number_format($rr2->Jumlah, 2), $r2->Satuan, number_format($rr2->Harga, 2), number_format($rr2->Harga * $rr2->Jumlah, 2)));
         $hgb = $r2->ID_Jenis == '5' ? $hgb - $rr2->Harga * $rr2->Jumlah : $hgb + $rr2->Harga * $rr2->Jumlah;
     }
 }
 //sub tlot
 $hargaj = rdb('inv_pembayaran', 'ppn', 'sum(ppn) as ppn', "where no_transaksi='" . $r->NoUrut . "' and year(doc_date)='" . $r->Tahun . "'");
 $harga = $harga + ($hgb - $hargaj);