private string print_header() { //string outstuff = ""; //Print the store name, centered bold double size //string outstuff = "\x1B\x70\x40" + CRLF; //Open drawer string outstuff = ""; // OposPrinter.open_drawer(); //Open drawer StoreSettings store_settings = new StoreSettings(this.base_data.lokasi); outstuff += OposPrinter.align_center() + store_settings.get_store_name() + OposPrinter.CRLF; //Print address lines centered outstuff += OposPrinter.font0() + OposPrinter.bold_off() + OposPrinter.align_center() + store_settings.get_address1() + OposPrinter.CRLF + store_settings.get_address2() + OposPrinter.CRLF + OposPrinter.CRLF; //Cashier and date/time outstuff += OposPrinter.align_left() + OposPrinter.font1() + "Kasir:" + String.Format("{0,-21}", this.base_data.nmkas) + " " + String.Format("{0:dd MMM yyyy}", this.base_data.tgl) + OposPrinter.CRLF; //Transaction number outstuff += OposPrinter.underline() + "No: " + String.Format("{0,-35}", this.base_data.nobukti) + OposPrinter.CRLF; //Column headers outstuff += OposPrinter.underline_off() + "Qty " + " Harga" + " Disc " + "Total" + OposPrinter.CRLF; //Thats all folks return(outstuff); }
private string print_data_rows() { string outstuff = ""; int qty = 0; double discount_total = 0; foreach (saleItem an_item in this.sales_items) { qty += an_item.quantity_qty; //need this for later, why is it not part of the class! string price = String.Format("{0,10}", an_item.item_price_hjual.ToString("##,###,###")); string discount = String.Format("{0,9}", an_item.discrp.ToString("#,###,###")); discount_total += an_item.discrp; string total = ((an_item.quantity_qty * an_item.item_price_hjual) - an_item.discrp).ToString("N0"); //come back to this string total = String.Format("{0,14}", an_item..total.ToString("##,###,###,###,###")); outstuff += OposPrinter.align_left() + OposPrinter.font1() + String.Format("{0,-4}", an_item.quantity_qty.ToString()) + price + " " + discount + " " + total + OposPrinter.CRLF; //line 2 string desc; //Fix me toooooo if (an_item.description.Length > 17) { desc = an_item.description.Substring(0, 18); } else { desc = String.Format("{0,-18}", an_item.description); } outstuff += " PLU: " + an_item.item_code_kdbrg + " " + desc + OposPrinter.CRLF; } //Add a dummy row underlined outstuff += OposPrinter.underline() + String.Format("{0,39}", " ") + OposPrinter.underline_off() + OposPrinter.CRLF; //The totals // sale_transaction.get outstuff += OposPrinter.bold() + String.Format("{0,-12}", qty.ToString()) + "Total:" + String.Format("{0,21}", "Rp. " + (this.getNSales() + this.getYSales()).ToString("###,###,###,###,###")) + OposPrinter.bold_off() + OposPrinter.CRLF; //Now time for the payments decimal payment_total = 0; outstuff += OposPrinter.underline() + String.Format("{0,-39}", "Pembayaran") + OposPrinter.underline_off() + OposPrinter.CRLF; foreach (PaymentItem pi in this.payment_items) { string pay_type, account; switch (pi.pay_type) { case PaymentType.Cash: pay_type = "Tunai"; account = " "; break; case PaymentType.CreditCard: pay_type = "K. Kredit"; account = "XXXX-" + pi.account_number.Substring(pi.account_number.Length - 4, 4); break; case PaymentType.DebitCard: pay_type = "K. Debit"; account = "XXXX-" + pi.account_number.Substring(pi.account_number.Length - 4, 4); break; case PaymentType.Voucher: pay_type = "Voucher"; account = pi.account_number; break; case PaymentType.StoreCredit: pay_type = "Piutang"; account = pi.account_number; break; default: pay_type = "Other"; account = pi.account_number; break; } payment_total += pi.amount; outstuff += String.Format("{0,-10}", pay_type) + String.Format("{0,-14}", account) + String.Format("{0,15}", pi.amount.ToString("###,###,###,###")) + OposPrinter.CRLF; } //Payment Total outstuff += OposPrinter.underline() + String.Format("{0,39}", " ") + OposPrinter.underline_off() + OposPrinter.CRLF; outstuff += OposPrinter.bold() + "Total Bayar:" + String.Format("{0,27}", "Rp. " + payment_total.ToString("###,###,###,###")) + OposPrinter.bold_off() + OposPrinter.CRLF; //The change decimal change_due = this.getPaymentTotal() - (this.getNSales() + this.getYSales()); outstuff += OposPrinter.bold() + " Kembali:" + String.Format("{0,27}", "Rp. " + change_due.ToString("###,###,###,##0")) + OposPrinter.bold_off() + OposPrinter.CRLF; //discount message if (discount_total > 0) { outstuff += OposPrinter.align_center() + "Anda Hemat Rp." + discount_total.ToString("###,###,###,###") + OposPrinter.CRLF + OposPrinter.align_left() + OposPrinter.CRLF; } return(outstuff); }