예제 #1
0
        private void CetakTagih2(DataTable dtCetak, int nMulai)
        {
            BuildString PrintTagih = new BuildString();

            string NamaToko  = dtCetak.Rows[0]["NamaToko"].ToString();
            string Alamat    = dtCetak.Rows[0]["AlamatKirim"].ToString();
            string Kota      = dtCetak.Rows[0]["Kota"].ToString();
            string Daerah    = dtCetak.Rows[0]["Daerah"].ToString();
            string Propinsi  = dtCetak.Rows[0]["Propinsi"].ToString();
            string WilID     = dtCetak.Rows[0]["WilID"].ToString();
            string InfoTagih = dtCetak.Rows[0]["RefCollector"].ToString();
            string Telp      = dtCetak.Rows[0]["Telp"].ToString();
            int    nn        = nMulai;
            int    nRec      = dtCetak.Rows.Count;

            Alamat += ", " + Kota;
            Daerah  = (string.IsNullOrEmpty(Daerah) == true ? string.Empty : Daerah + ", ") +
                      (string.IsNullOrEmpty(Propinsi) == true ? string.Empty : Propinsi + "  ") +
                      (string.IsNullOrEmpty(WilID) == true ? string.Empty : "(" + WilID + ")");
            NamaToko += string.IsNullOrEmpty(Telp) == true ? string.Empty : "  ==>  TELPON : " + Telp;

            PrintTagih.FontCondensed(true);
            PrintTagih.PageLLine(33);

            for (int i = 1; i <= 9 + (nn - 1); i++)
            {
                PrintTagih.PROW(true, 1, "");
            }

            int      ctr        = 1;
            double   Total      = 0;
            string   NoNota     = string.Empty;
            string   IdTr       = string.Empty;
            string   KodeSales  = string.Empty;
            string   HariKredit = string.Empty;
            DateTime TglTerima;
            DateTime TglJT;
            double   RpNet3 = 0;

            foreach (DataRowView dr in dtCetak.DefaultView)
            {
                NoNota     = dr["NoNota"].ToString();
                IdTr       = dr["TransactionType"].ToString();
                TglTerima  = DateTime.Parse(dr["TglTerima"].ToString());
                KodeSales  = dr["KodeSales"].ToString();
                HariKredit = dr["HariKredit"].ToString();
                TglJT      = DateTime.Parse(dr["TglJT"].ToString());
                RpNet3     = double.Parse(dr["RpNet3"].ToString());

                if (nn >= nMulai)
                {
                    PrintTagih.PROW(true, 1, "  " +
                                    "   " + TglTerima.ToString("dd-MM-yyyy") +
                                    " " + NoNota +
                                    " " + IdTr +
                                    "  " + KodeSales +
                                    "  " + HariKredit.PadLeft(2) +
                                    "  " + TglJT.ToString("dd-MM-yyyy") +
                                    " " + RpNet3.ToString("#,##0").PadLeft(13) +
                                    "                         ");
                }

                if (nn == 12)
                {
                    PrintTagih.Eject();
                    break;
                }
                nn++;
            }

            //int ii = 1;
            ctr   = 1;
            Total = 0;

            if (nRec > 12)
            {
                PrintTagih.Append(CetakHeader(NamaToko, Alamat, Daerah));
                foreach (DataRow dr in dtCetak.Rows)
                {
                    NoNota     = dr["NoNota"].ToString();
                    IdTr       = dr["TransactionType"].ToString();
                    TglTerima  = DateTime.Parse(dr["TglTerima"].ToString());
                    KodeSales  = dr["KodeSales"].ToString();
                    HariKredit = dr["HariKredit"].ToString();
                    TglJT      = DateTime.Parse(dr["TglJT"].ToString());
                    RpNet3     = double.Parse(dr["RpNet3"].ToString());
                    Total     += RpNet3;

                    //if (nn > 12) // <- Logic yg aneh dr sistem yg lama
                    //{
                    PrintTagih.PROW(true, 1, "³" + ctr.ToString().PadLeft(2) +
                                    "³ " + TglTerima.ToString("dd-MM-yyyy") +
                                    "³" + NoNota +
                                    "³" + IdTr +
                                    " ³" + KodeSales +
                                    " ³" + HariKredit.PadLeft(2) +
                                    "³ " + TglJT.ToString("dd-MM-yyyy") +
                                    "³" + RpNet3.ToString("#,##0").PadLeft(13) +
                                    "³           ³           ³");

                    if (ctr == 12)     //<- Original if (ii == 13), logic yg aneh. ??
                    {
                        PrintTagih.PROW(true, 1, "ÔÍÍÏÍÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÏÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÏÍÍÏÍÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍ;");
                        PrintTagih.PROW(true, 1, "                                             Jumlah     " + Total.ToString("#,##0").PadLeft(13));
                        PrintTagih.Eject();
                        ctr = 0;
                        //ii = 1;
                        Total = 0;
                        PrintTagih.Append(CetakHeader(NamaToko, Alamat, Daerah));
                    }
                    //}

                    ctr++;
                    //ii++;
                    nn++;
                }

                nn = (12 - ctr);
                for (int j = 1; j <= (nn + 1); j++)
                {
                    PrintTagih.PROW(true, 1, "³" + ctr.ToString().PadLeft(2) + "³" + "           ³       ³   ³            ³  ³           ³             ³           ³           ³");
                    ctr++;
                }
                PrintTagih.PROW(true, 1, "ÔÍÍÏÍÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÏÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÏÍÍÏÍÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍ;");
                PrintTagih.PROW(true, 1, "                                             Jumlah     " + Total.ToString("#,##0").PadLeft(13));
            }

            PrintTagih.FontCondensed(false);
            PrintTagih.Eject();
            //PrintTagih.SendToPrinter("RencanaTagihan2.txt");
            PrintTagih.SendToFile("RencanaTagihan2.txt");
        }
예제 #2
0
        private void CetakTagih1(DataTable dtCetak)
        {
            BuildString PrintTagih = new BuildString();

            string NamaToko  = dtCetak.Rows[0]["NamaToko"].ToString();
            string Alamat    = dtCetak.Rows[0]["AlamatKirim"].ToString();
            string Kota      = dtCetak.Rows[0]["Kota"].ToString();
            string Daerah    = dtCetak.Rows[0]["Daerah"].ToString();
            string Propinsi  = dtCetak.Rows[0]["Propinsi"].ToString();
            string WilID     = dtCetak.Rows[0]["WilID"].ToString();
            string InfoTagih = dtCetak.Rows[0]["RefCollector"].ToString();
            string Telp      = dtCetak.Rows[0]["Telp"].ToString();

            Alamat += ", " + Kota;
            Daerah  = (string.IsNullOrEmpty(Daerah) == true ? string.Empty : Daerah + ", ") +
                      (string.IsNullOrEmpty(Propinsi) == true ? string.Empty : Propinsi + "  ") +
                      (string.IsNullOrEmpty(WilID) == true ? string.Empty : "(" + WilID + ")");
            NamaToko += string.IsNullOrEmpty(Telp) == true ? string.Empty : "  ==>  TELPON : " + Telp;

            PrintTagih.FontCondensed(true);
            PrintTagih.PageLLine(33);
            PrintTagih.Append(CetakHeader(NamaToko, Alamat, Daerah));

            int      ctr        = 1;
            double   Total      = 0;
            string   NoNota     = string.Empty;
            string   IdTr       = string.Empty;
            string   KodeSales  = string.Empty;
            string   HariKredit = string.Empty;
            DateTime TglTerima;
            DateTime TglJT;
            double   RpNet3 = 0;

            foreach (DataRowView dr in dtCetak.DefaultView)
            {
                NoNota     = dr["NoNota"].ToString();
                IdTr       = dr["TransactionType"].ToString();
                TglTerima  = DateTime.Parse(dr["TglTerima"].ToString());
                KodeSales  = dr["KodeSales"].ToString();
                HariKredit = dr["HariKredit"].ToString();
                TglJT      = DateTime.Parse(dr["TglJT"].ToString());
                RpNet3     = double.Parse(dr["RpNet3"].ToString());
                Total     += RpNet3;

                PrintTagih.PROW(true, 1, "³" + ctr.ToString().PadLeft(2) +
                                "³ " + TglTerima.ToString("dd-MM-yyyy") +
                                "³" + NoNota +
                                "³" + IdTr +
                                " ³" + KodeSales.PadRight(11) +
                                " ³" + HariKredit.PadLeft(2) +
                                "³ " + TglJT.ToString("dd-MM-yyyy") +
                                "³" + RpNet3.ToString("#,##0").PadLeft(13) +
                                "³           ³           ³");
                if (ctr == 12)
                {
                    PrintTagih.PROW(true, 1, "ÔÍÍÏÍÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÏÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÏÍÍÏÍÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍ;");
                    PrintTagih.PROW(true, 1, "                                             Jumlah     " + Total.ToString("#,##0").PadLeft(13));
                    PrintTagih.Eject();
                    ctr   = 0;
                    Total = 0;
                    PrintTagih.Append(CetakHeader(NamaToko, Alamat, Daerah));
                }
                ctr++;
            }

            int n = 12 - (ctr - 1);

            for (int i = 1; i <= n + 1; i++)
            {
                PrintTagih.PROW(true, 1, "³" + ctr.ToString().PadLeft(2) + "³" + "           ³       ³   ³            ³  ³           ³             ³           ³           ³");
                ctr++;
            }
            PrintTagih.PROW(true, 1, "ÔÍÍÏÍÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÏÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÏÍÍÏÍÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍ;");
            PrintTagih.PROW(true, 1, "                                             Jumlah     " + Total.ToString("#,##0").PadLeft(13));
            PrintTagih.PROW(true, 1, "Info Tagih : " + InfoTagih);
            PrintTagih.FontCondensed(false);
            PrintTagih.Eject();

            PrintTagih.SendToPrinter("RencanaTagihan.txt");
            //PrintTagih.SendToFile("RencanaTagihan.txt");
        }