コード例 #1
0
        private void Cetak(DataTable dt)
        {
            BuildString detail = new BuildString();

            string NoDKN   = Tools.isNull(dt.Rows[0]["NoDKN"], "").ToString();
            string Tanggal = Tools.isNull(dt.Rows[0]["Tanggal"], "").ToString();
            string Cabang  = Tools.isNull(dt.Rows[0]["Cabang"], "").ToString();
            string DK      = Tools.isNull(dt.Rows[0]["DK"], "").ToString();

            string headerTitle = string.Empty;
            string deskripsi   = string.Empty;
            int    posHeader   = 0;

            if (DK == "K")
            {
                headerTitle = "KREDIT NOTA";
                deskripsi   = "Dengan ini kami menkredit Rekening Saudara untuk transaksi sebagai berikut";
                posHeader   = 12;
            }
            else if (DK == "D")
            {
                headerTitle = "DEBET NOTA";
                deskripsi   = "Dengan ini kami mendebet Rekening Saudara untuk transaksi sebagai berikut";
                posHeader   = 13;
            }

            string Perkiraan   = string.Empty;
            string Uraian      = string.Empty;
            double Jumlah      = 0;
            double sumJumlah   = 0;
            string tempJumlah  = string.Empty;
            string typePrinter = detail.GetPrinterName();

            detail.Initialize();
            detail.FontCondensed(false);
            detail.FontCPI(7);
            detail.PageLLine(33);
            detail.LeftMargin(5);
            detail.BottomMargin(1);
            detail.FontCondensed(true);


            #region Header
            if (typePrinter.Contains("LX"))
            {
                detail.LetterQuality(false);
                detail.FontBold(true);
                detail.FontCondensed(true);
                detail.DoubleHeight(true);
            }
            else
            {
                detail.LetterQuality(true);
                detail.FontBold(true);
                detail.DoubleHeight(true);
                detail.DoubleWidth(true);
            }

            detail.FontBold(false);
            detail.DoubleHeight(false);
            detail.DoubleWidth(false);
            detail.FontCondensed(false);
            detail.LineSpacing("1/8");

            detail.AddCR();
            detail.FontCPI(12);
            detail.PROW(true, 1, detail.PrintTopLeftCorner() + detail.PrintHorizontalLine(92) + detail.PrintTopRightCorner());
            detail.PROW(false, 30, detail.PrintTTOp());

            detail.PROW(true, 1, detail.PrintVerticalLine());
            //detail.FontBold(true);


            //detail.FontBold(false);
            detail.PROW(false, 30, detail.PrintVerticalLine() + " Tanggal   : " + ((DateTime)dt.Rows[0]["Tanggal"]).ToString("dd/MM/yyyy").PadRight(51) + detail.PrintVerticalLine());


            detail.PROW(true, 1, detail.PrintVerticalLine());
            detail.FontCPI(14);
            detail.FontBold(true);
            detail.PROW(false, posHeader, headerTitle);
            detail.FontCPI(12);
            detail.FontBold(false);
            detail.PROW(false, 36, detail.PrintTLeft() + detail.PrintHorizontalLine(64) + detail.PrintTRight());


            detail.PROW(true, 1, detail.PrintVerticalLine());
            detail.PROW(false, 30, detail.PrintVerticalLine() + detail.SPACE(1) + "Kepada    : Kepala Administrasi " + Cabang.PadRight(31) + detail.PrintVerticalLine());

            detail.PROW(true, 1, detail.PrintVerticalLine());
            detail.PROW(false, 8, "[No: " + NoDKN + "]");
            detail.PROW(false, 30, detail.PrintTLeft() + detail.PrintHorizontalLine(64) + detail.PrintTRight());

            detail.PROW(true, 1, detail.PrintVerticalLine());
            detail.PROW(false, 30, detail.PrintVerticalLine() + detail.SPACE(1) + "Lampiran  :" + detail.SPACE(10) + "lbr: ".PadRight(42) + detail.PrintVerticalLine());

            detail.PROW(true, 1, detail.PrintTLeft() + detail.PrintHorizontalLine(92) + detail.PrintTRight());
            detail.PROW(false, 30, detail.PrintTBottom());

            detail.PROW(true, 1, detail.PrintVerticalLine() + deskripsi.PadRight(93) + detail.PrintVerticalLine());
            detail.PROW(true, 1, detail.PrintTLeft() + detail.PrintHorizontalLine(91) + detail.PrintTRight());
            detail.PROW(false, 15, detail.PrintTTOp());
            detail.PROW(false, 84, detail.PrintTTOp());

            detail.PROW(true, 1, detail.PrintVerticalLine() + "  Perkiraan  " + detail.PrintVerticalLine() + detail.SPACE(31) + "Uraian" + detail.SPACE(31) + detail.PrintVerticalLine() + "  Jumlah  " + detail.PrintVerticalLine());
            detail.PROW(true, 1, detail.PrintTLeft() + detail.PrintHorizontalLine(91) + detail.PrintTRight());
            detail.PROW(false, 15, detail.PrintTLeft());
            detail.PROW(false, 84, detail.PrintTRight());

            #endregion



            #region CetakDetail

            foreach (DataRow dr in dt.Rows)
            {
                Perkiraan  = dr["NoPerkiraan"].ToString();
                Uraian     = dr["Uraian"].ToString();
                Jumlah     = double.Parse(dr["Jumlah"].ToString());
                sumJumlah  = sumJumlah + Jumlah;
                tempJumlah = Jumlah.ToString("#,##0");
                detail.PROW(true, 1, detail.PrintVerticalLine() + Perkiraan + detail.SPACE(1) + detail.PrintVerticalLine() + Uraian.PadRight(68) + detail.PrintVerticalLine() + tempJumlah.PadLeft(10) + detail.PrintVerticalLine());
                detail.PROW(true, 1, detail.PrintTLeft() + detail.PrintHorizontalLine(91) + detail.PrintTRight());
                detail.PROW(false, 15, detail.PrintTBottom());
                detail.PROW(false, 84, detail.PrintTBottom());
                //header.PROW(true, 1, header.PrintVerticalLine() + header.SPACE(2) + "Perkiraan" + header.SPACE(2) + header.PrintVerticalLine() + header.SPACE(22) + "Uraian" + header.SPACE(22) + header.PrintVerticalLine() + header.SPACE(2) + "Jumlah" + header.SPACE(2) + header.PrintVerticalLine());
            }

            detail.PROW(true, 1, detail.PrintVerticalLine() + detail.SPACE(14) + "Total" + detail.SPACE(64) + sumJumlah.ToString("#,##0").PadLeft(10) + detail.PrintVerticalLine());
            detail.PROW(true, 1, detail.PrintTLeft() + detail.PrintHorizontalLine(93) + detail.PrintTRight());


            detail.PROW(true, 1, detail.PrintVerticalLine() + "Terbilang" + detail.SPACE(5) + ISA.Common.Tools.Terbilang(sumJumlah).PadRight(79) + detail.PrintVerticalLine());
            detail.PROW(true, 1, detail.PrintVerticalLine() + detail.SPACE(93) + detail.PrintVerticalLine());
            detail.PROW(true, 1, detail.PrintTLeft() + detail.PrintHorizontalLine(91) + detail.PrintTRight());
            detail.PROW(false, 32, detail.PrintTTOp());
            detail.PROW(false, 61, detail.PrintTTOp());

            #endregion


            #region Footer

            detail.PROW(true, 1, detail.PrintVerticalLine() + "          Dibuat Oleh         " + detail.PrintVerticalLine() + "         Mengetahui         " + detail.PrintVerticalLine() + "         Dibukukan Oleh          " + detail.PrintVerticalLine());
            detail.PROW(true, 1, detail.PrintTLeft() + detail.PrintHorizontalLine(91) + detail.PrintTRight());
            detail.PROW(false, 32, detail.PrintTTOp());
            detail.PROW(false, 61, detail.PrintTTOp());

            detail.PROW(true, 1, detail.PrintVerticalLine() + "                              " + detail.PrintVerticalLine() + "                            " + detail.PrintVerticalLine() + "                                 " + detail.PrintVerticalLine());
            detail.PROW(true, 1, detail.PrintVerticalLine() + "                              " + detail.PrintVerticalLine() + "                            " + detail.PrintVerticalLine() + "                                 " + detail.PrintVerticalLine());
            detail.PROW(true, 1, detail.PrintVerticalLine() + "                              " + detail.PrintVerticalLine() + "                            " + detail.PrintVerticalLine() + "                                 " + detail.PrintVerticalLine());
            detail.PROW(true, 1, detail.PrintVerticalLine() + "                              " + detail.PrintVerticalLine() + "                            " + detail.PrintVerticalLine() + "                                 " + detail.PrintVerticalLine());
            detail.PROW(true, 1, detail.PrintVerticalLine() + "                              " + detail.PrintVerticalLine() + "                            " + detail.PrintVerticalLine() + "                                 " + detail.PrintVerticalLine());
            detail.PROW(true, 1, detail.PrintVerticalLine() + "            MNG               " + detail.PrintVerticalLine() + "                            " + detail.PrintVerticalLine() + "                                 " + detail.PrintVerticalLine());
            detail.PROW(true, 1, detail.PrintBottomLeftCorner() + detail.PrintHorizontalLine(91) + detail.PrintRightBottomCorner2());
            detail.PROW(false, 32, detail.PrintTBottom());
            detail.PROW(false, 61, detail.PrintTBottom());


            #endregion



            detail.Eject();
            detail.SendToPrinter("DebetKreditNota.txt", detail.GenerateString());
        }
コード例 #2
0
        private string CetakHeaderBO(DataTable dt, int nUrut, int nMaxHal, out int nHlm)
        {
            BuildString header = new BuildString();

            const int RowsPerPage = 16;

            int nHal = (int)Math.Round((nUrut / RowsPerPage) + 0.4, 0) + 1;

            nHlm = nHal;

            string cat1         = dt.Rows[0]["Catatan1"].ToString();
            string cat2         = dt.Rows[0]["Catatan2"].ToString();
            string sales        = GetSales();
            string namaToko     = dt.Rows[0]["NamaToko"].ToString();
            string cClass       = dt.Rows[0]["StsToko"].ToString();
            string TglDO        = header.GetDayName(DateTime.Now.DayOfWeek.ToString()) + ", " + DateTime.Now.ToString("dd-MMM-yyyy");
            string DO           = dt.Rows[0]["NoDO"].ToString() + " " + header.GetDayName(Convert.ToDateTime(dt.Rows[0]["TglDO"].ToString()).DayOfWeek.ToString()) + ", " + Convert.ToDateTime(dt.Rows[0]["TglDO"].ToString()).ToString("dd-MMM-yyyy");
            string noRq         = dt.Rows[0]["NoRequest"].ToString() + " " + header.GetDayName(Convert.ToDateTime(dt.Rows[0]["TglRequest"].ToString()).DayOfWeek.ToString()) + ", " + Convert.ToDateTime(dt.Rows[0]["TglRequest"].ToString()).ToString("dd-MMM-yyyy");
            string alamatKirim  = header.Alamat(dt.Rows[0]["Alamat"].ToString());
            string nSpace       = namaToko.Trim() + header.SPACE(namaToko.Trim().Length + (15 - namaToko.Trim().Length) - 7) + cClass;
            string waktu        = dt.Rows[0]["HariKredit"].ToString() + " Hari / ";
            string wilID        = dt.Rows[0]["WilID"].ToString().Trim();
            string daerah       = header.Daerah(dt.Rows[0]["Daerah"].ToString()) + "(Wil: " + wilID + ") ";
            string kota         = header.Kota(dt.Rows[0]["Kota"].ToString());
            string expedisi     = dt.Rows[0]["Expedisi"].ToString();
            string namaExpedisi = dt.Rows[0]["NamaExpedisi"].ToString();
            double plafon       = double.Parse(dt.Rows[0]["Plafon"].ToString());
            string grade        = dt.Rows[0]["Grade"].ToString();

            #region Cetak Header
            header.Initialize();
            header.FontCondensed(false);
            header.FontCPI(12);
            header.PageLLine(33);
            header.LeftMargin(1);
            header.BottomMargin(1);
            header.DoubleHeight(true);
            header.DoubleWidth(true);
            header.PROW(true, 1, "DELIVERY ORDER  (BO)");
            header.DoubleHeight(false);
            header.DoubleWidth(false);
            header.LetterQuality(true);
            header.FontCPI(12);
            header.FontBold(true);
            header.PROW(true, 1, header.Sales(sales));
            header.FontBold(false);
            header.FontItalic(false);
            header.LineSpacing("1/6");
            header.FontItalic(true);
            header.AddCR();
            header.Append(" ");
            header.FontItalic(false);
            header.FontCondensed(true);
            header.PROW(false, 53, header.PrintTopLeftCorner() + header.PrintHorizontalLine(2) + " Pengiriman kepada Toko " + header.PrintHorizontalLine(14) + header.PrintTopRightCorner());
            header.PROW(true, 1, cat1.PadRight(47, ' '));
            header.PROW(false, 51, header.PrintVerticalLine() + header.SPACE(40) + header.PrintVerticalLine());
            header.FontBold(true);
            header.AddCR();
            header.PROW(false, 55, nSpace);
            header.FontBold(false);
            header.FontBold(true);
            header.PROW(true, 1, "TGL.DOBO  : ");
            header.FontBold(false);
            header.FontItalic(true);
            header.AddCR();
            header.PROW(false, 13, TglDO);
            header.FontItalic(false);
            header.PROW(false, 53, header.PrintVerticalLine() + header.SPACE(40) + header.PrintVerticalLine());
            //header.FontCondensed(true);
            header.FontItalic(true);
            header.AddCR();
            header.PROW(false, 92, alamatKirim);
            header.FontItalic(false);
            //header.FontCondensed(false);
            header.FontBold(true);
            header.PROW(true, 1, "ASAL D.O  : ");
            header.FontBold(false);
            header.FontItalic(true);
            header.AddCR();
            header.PROW(false, 13, DO);
            header.FontItalic(false);
            header.PROW(false, 53, header.PrintVerticalLine() + header.SPACE(40) + header.PrintVerticalLine());
            header.FontItalic(true);
            header.AddCR();
            header.PROW(false, 55, daerah);
            header.FontItalic(false);
            header.FontBold(true);
            header.PROW(true, 1, "JK.WAKTU  : ");
            header.FontBold(false);
            header.FontItalic(true);
            header.AddCR();
            header.PROW(false, 13, waktu + cat2.PadRight(20, ' '));
            header.FontItalic(false);
            header.PROW(false, 53, header.PrintVerticalLine() + header.SPACE(40) + header.PrintVerticalLine());
            header.FontItalic(true);
            header.AddCR();
            header.PROW(false, 55, kota);
            header.FontItalic(false);
            header.FontBold(true);
            header.PROW(true, 1, "NOMOR RQ. : ");
            header.FontBold(false);
            header.FontItalic(true);
            header.AddCR();
            header.PROW(false, 13, noRq);
            header.FontItalic(false);
            header.PROW(false, 53, header.PrintVerticalLine() + header.SPACE(31) + "Grade:   " + header.PrintVerticalLine());
            header.FontItalic(true);
            header.AddCR();
            header.PROW(false, 55, "PLAFON :" + plafon.ToString("#,###").PadLeft(14, ' '));
            header.FontItalic(false);
            header.PROW(false, 91, header.STR(2, grade));
            header.FontItalic(false);
            header.FontBold(true);
            header.PROW(true, 1, "EXPEDISI  : ");
            header.FontBold(false);
            header.FontItalic(true);
            header.AddCR();
            header.PROW(false, 13, expedisi + " (" + namaExpedisi + ")");
            header.FontItalic(false);
            header.PROW(false, 53, header.PrintBottomLeftCorner() + header.PrintHorizontalLine(40) + header.PrintBottomRightCorner());
            header.LetterQuality(false);
            //header.FontCondensed(true);
            header.LineSpacing("1/6");
            header.PROW(true, 1, "No. N a m a   B a r a n g                                            RAK   Dipesan            Dikirim             H.Sat.   Disc./Pot. Jml.Net    Stok");
            header.PROW(true, 1, header.PrintDoubleLine(151));

            #endregion

            return(header.GenerateString());
        }
コード例 #3
0
        private void PrintRawSPPB(DataTable dt)
        {
            BuildString sppb = new BuildString();
            int         No   = 1;
            int         n    = dt.Rows.Count;
            int         i    = 0;
            int         p    = 0;
            int         s    = 0;

            p = n / 13;
            s = n % 13;

            bool _repeat = true;


            #region "Header"
            sppb.Initialize();
            sppb.LeftMargin(1);
            sppb.BottomMargin(1);

            sppb.PROW(true, 1, "KODE RAK :                                                                                  				      TANGGAL :");

            #endregion


            string _NamaStok = string.Empty;
            string _Pcs      = string.Empty;
            string _Lok      = string.Empty;

            string _Header1 = sppb.PrintTopLeftCorner() + sppb.PrintDoubleLine(4) + sppb.PrintTTOp() + sppb.PrintDoubleLine(77) + sppb.PrintTTOp() + sppb.PrintDoubleLine(3) + sppb.PrintTTOp() + sppb.PrintDoubleLine(15) + sppb.PrintTTOp() + sppb.PrintDoubleLine(15) + sppb.PrintTTOp() + sppb.PrintDoubleLine(15) + sppb.PrintTTOp() + sppb.PrintDoubleLine(7) + sppb.PrintTopRightCorner();
            string _Header2 = sppb.PrintVerticalLine() + "No. " + sppb.PrintVerticalLine() + "                       N  A  M  A      B  A  R  A  N  G                      " + sppb.PrintVerticalLine() + "SAT" + sppb.PrintVerticalLine() + "        1      " + sppb.PrintVerticalLine() + "       2       " + sppb.PrintVerticalLine() + "       3       " + sppb.PrintVerticalLine() + "   OK. " + sppb.PrintVerticalLine();
            string _Header3 = sppb.PrintTLeft() + sppb.PrintDoubleLine(4) + sppb.PrintTMidlle() + sppb.PrintDoubleLine(77) + sppb.PrintTMidlle() + sppb.PrintDoubleLine(3) + sppb.PrintTMidlle() + sppb.PrintDoubleLine(15) + sppb.PrintTMidlle() + sppb.PrintDoubleLine(15) + sppb.PrintTMidlle() + sppb.PrintDoubleLine(15) + sppb.PrintTMidlle() + sppb.PrintDoubleLine(7) + sppb.PrintTRight();
            string _Footer1 = sppb.PrintTLeft() + sppb.PrintHorizontalLine(4) + sppb.PrintTMidlle() + sppb.PrintHorizontalLine(77) + sppb.PrintTMidlle() + sppb.PrintHorizontalLine(3) + sppb.PrintTMidlle() + sppb.PrintHorizontalLine(15) + sppb.PrintTMidlle() + sppb.PrintHorizontalLine(15) + sppb.PrintTMidlle() + sppb.PrintHorizontalLine(15) + sppb.PrintTMidlle() + sppb.PrintHorizontalLine(7) + sppb.PrintTRight();
            string _Footer2 = sppb.PrintBottomLeftCorner() + sppb.PrintHorizontalLine(4) + sppb.PrintTBottom() + sppb.PrintHorizontalLine(77) + sppb.PrintTBottom() + sppb.PrintHorizontalLine(3) + sppb.PrintTBottom() + sppb.PrintHorizontalLine(15) + sppb.PrintTBottom() + sppb.PrintHorizontalLine(15) + sppb.PrintTBottom() + sppb.PrintHorizontalLine(15) + sppb.PrintTBottom() + sppb.PrintHorizontalLine(7) + sppb.PrintBottomRightCorner();
            string _temp    = sppb.PrintVerticalLine() + "               " + sppb.PrintVerticalLine() + "               " + sppb.PrintVerticalLine() + "               " + sppb.PrintVerticalLine();
            foreach (DataRow dr in dt.Rows)
            {
                #region "Header"
                if (i == 0 && _repeat)
                {
                    sppb.PROW(true, 1, _Header1);
                    sppb.PROW(true, 1, _Header2);
                    sppb.PROW(true, 1, _Header3);
                }

                #endregion
                if (i <= 13)
                {
                    _NamaStok = dr["NamaStok"].ToString();
                    _Pcs      = dr["SatJual"].ToString();
                    _Lok      = dr["Lokasi"].ToString();



                    sppb.PROW(true, 1, sppb.PrintVerticalLine() + No.ToString().PadLeft(4, ' ') + sppb.PrintVerticalLine() + _NamaStok.PadRight(73, '.') + sppb.SPACE(4) + sppb.PrintVerticalLine() + _Pcs.PadLeft(3, ' ') + _temp + _Lok.PadLeft(7, ' ') + sppb.PrintVerticalLine());

                    sppb.PROW(true, 1, (No == n || i == 12) ? _Footer2 : _Footer1);

                    _repeat = false;
                    if (i == 12 || No == n)
                    {
                        sppb.PROW(true, 1, " ");
                        _repeat = true;
                        i       = -1;
                        sppb.Eject();
                    }
                }

                i++;
                No++;
            }



            sppb.SendToPrinter("sppb.txt", sppb.ToString());
        }
コード例 #4
0
        private void PrintOutDotMatrix()
        {
            BuildString data = new BuildString();

            data.Initialize();
            data.PageLLine(33);
            data.LeftMargin(1);
            data.BottomMargin(1);

            data.LetterQuality(false);
            data.FontBold(true);
            data.FontCondensed(true);
            data.DoubleHeight(true);

            data.PROW(true, 1, "");

            data.DoubleWidth(true);
            data.DoubleHeight(true);
            data.FontCPI(12);
            data.LineSpacing("1/8");
            //data.PROW(false, 2, Convert.ToString((char)27) + Convert.ToString((char)33) + Convert.ToString((char)12));
            data.PROW(true, 1, "Register Tagihan");
            data.DoubleWidth(false);
            data.DoubleHeight(false);

            /*                  12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890*/
            /*                           1         2         3         4         5         6         7         8         9         10        11        12        13        14*/
            data.FontCondensed(true);
            data.PROW(true, 1, "    Customer                                    Part Number             Q t y    Harga Sat     Disc(%)   Pot          Jumlah Harga");
            data.PROW(true, 1, data.PrintDoubleLine(134));

            //foreach (DataRow dr in dt.Rows)
            //{
            string _customer1 = "YATIK", _customer2 = "RAYZA LUTHFI", _customer3 = "RAFA ANADA RADITIYA AHMAD";
            int    panjanghuruf = _customer1.Length;

            if (panjanghuruf >= 25)
            {
                _customer1 = _customer1.Substring(0, 30);
            }
            int panjanghuruf2 = _customer1.Length;

            if (panjanghuruf2 >= 25)
            {
                _customer2 = _customer2.Substring(0, 30);
            }
            string sTemp = "";

            sTemp = sTemp + _customer1.PadRight(25, ' ') + " | ";
            data.PROW(true, 1, sTemp);

            sTemp = "";
            sTemp = sTemp + _customer2.PadRight(25, ' ') + " | ";
            data.PROW(true, 1, sTemp);

            sTemp = "";
            sTemp = sTemp + _customer3.PadRight(25, ' ') + " | ";
            data.PROW(true, 1, sTemp);

            //}



            data.Eject();
            data.SendToPrinter("Register_Tagihan.txt");

            //data.SendToTxt("Register_Tagihan.txt", data.GenerateString());
            //detail.SendToPrinter("Register_Tagihan.txt");   //, detail.GenerateString());

            MessageBox.Show("Proses Cetak Selesai..");
        }