Exemplo n.º 1
0
        private void Header()
        {
            System.Text.StringBuilder x = new System.Text.StringBuilder();

            Rpt.Judul(x, comp, judul);

            if (StatusA != "")
            {
                Rpt.SubJudul(x, "Status : " + StatusA);
            }
            else if (StatusI != "")
            {
                Rpt.SubJudul(x, "Status : " + StatusI);
            }
            else
            {
                Rpt.SubJudul(x, "Status : " + StatusS);
            }

            string sifat = "";

            if (nSifat == "sifatALL")
            {
                sifat = "SEMUA";
            }
            else if (nSifat == "sifatSUDAH")
            {
                sifat = "sifatSUDAH";
            }
            else if (nSifat == "sifatBELUM")
            {
                sifat = "BELUM BELI";
            }

            Rpt.SubJudul(x
                         , "Sifat : " + sifat
                         );

            Rpt.SubJudul(x
                         , "Nama : " + Nama.Replace("-", ",").TrimEnd(',')
                         );

            Rpt.SubJudul(x
                         , "Agama : " + Agama.Replace("-", ",").TrimEnd(',')
                         );

            Rpt.SubJudul(x
                         , "Sumber Data : " + SumberData.Replace("-", ",").TrimEnd(',')
                         );

            Rpt.SubJudul(x
                         , "Periode Input : " + Input
                         );

            Rpt.SubJudul(x
                         , "Bulan Lahir : " + nLahir
                         );

            Rpt.SubJudul(x
                         , "Sales Account : " + nAgentInput
                         );

            Rpt.SubJudul(x
                         , "Project : " + Project
                         );

            //Rpt.Header(rpt, x);
            string legend = "* * = Inaktif";

            Rpt.HeaderReport(headReport, legend, x);
        }
Exemplo n.º 2
0
        void prosesRow(SumberData sumber, String keterangan)
        {
            Database1Entities db  = new Database1Entities();
            var   allPkt          = db.Pkts.ToList();
            Int64 d100            = (Int64)sumber.d100,
                  d50             = (Int64)sumber.d50,
                  d20             = (Int64)sumber.d20,
                  d10             = (Int64)sumber.d10,
                  d5              = (Int64)sumber.d5,
                  d2              = (Int64)sumber.d2;
            Int64      totalValue = (Int64)(d100 + d50 + d20 + d10 + d5 + d2);
            DataProses tempResult = new DataProses();
            String     vault      = sumber.namaBank.Split('-')[0];

            if (sumber.sumberDana.Split('-')[1].Trim() == "CCAS")
            {
                sumber.sumberDana = sumber.sumberDana.Replace("CCAS", "CCASA");
            }

            Console.WriteLine("Masuk Proses Row");
            //Console.WriteLine(sumber.sumberDana);
            String kodePktCabangSumber = sumber.sumberDana.Split('-')[1].Trim();
            String sumberDana          = allPkt.Where(x => x.kodePktCabang == kodePktCabangSumber).Select(x => x.namaPkt).FirstOrDefault(),
                   vendorSumber        = allPkt.Where(x => x.kodePkt == kodePktCabangSumber).Select(x => x.vendor).FirstOrDefault(),
                   kodeTujuan          = sumber.kodeTujuan.Trim();

            if (kodeTujuan.Contains("-"))
            {
                kodeTujuan = kodeTujuan.Split('-')[1].Trim();
            }

            String namaTujuan = allPkt.Where(x => x.kodePktCabang == kodeTujuan).Select(x => x.namaPkt).FirstOrDefault();

            //Console.WriteLine(sumberDana);
            tempResult.namaTujuan   = namaTujuan;
            tempResult.sumberDana   = sumberDana;
            tempResult.tujuan       = vault;
            tempResult.keterangan   = keterangan;
            tempResult.vendorSumber = vendorSumber;
            Int64 sisa = limitDelivery;

            //100K
            if (d100 > sisa)
            {
                while (d100 > sisa)
                {
                    tempResult.denom100 = sisa;
                    d100            -= sisa;
                    tempResult.total = tempResult.denom100 + tempResult.denom50 + tempResult.denom20 + tempResult.denom10 + tempResult.denom5 + tempResult.denom2;
                    result.Add(tempResult);
                    sisa                  = limitDelivery;
                    tempResult            = new DataProses();
                    tempResult.sumberDana = sumberDana;
                    tempResult.tujuan     = vault;
                    tempResult.keterangan = keterangan;
                }
            }
            if (d100 > 0)
            {
                tempResult.denom100 = d100;
                sisa -= d100;
            }
            //50K
            if (d50 > sisa)
            {
                while (d50 > sisa)
                {
                    tempResult.denom50 = sisa;
                    d50 -= sisa;
                    tempResult.total = tempResult.denom100 + tempResult.denom50 + tempResult.denom20 + tempResult.denom10 + tempResult.denom5 + tempResult.denom2;
                    result.Add(tempResult);
                    sisa                  = limitDelivery;
                    tempResult            = new DataProses();
                    tempResult.sumberDana = sumberDana;
                    tempResult.tujuan     = vault;
                    tempResult.keterangan = keterangan;
                }
            }
            if (d50 > 0)
            {
                tempResult.denom50 = d50;
                sisa -= d50;
            }
            //20K
            if (d20 > sisa)
            {
                while (d20 > sisa)
                {
                    tempResult.denom20 = sisa;
                    d20 -= sisa;
                    tempResult.total = tempResult.denom100 + tempResult.denom50 + tempResult.denom20 + tempResult.denom10 + tempResult.denom5 + tempResult.denom2;
                    result.Add(tempResult);
                    sisa                  = limitDelivery;
                    tempResult            = new DataProses();
                    tempResult.sumberDana = sumberDana;
                    tempResult.tujuan     = vault;
                    tempResult.keterangan = keterangan;
                }
            }
            if (d20 > 0)
            {
                tempResult.denom20 = d20;
                sisa -= d20;
            }
            //10K
            if (d10 > sisa)
            {
                while (d10 > sisa)
                {
                    tempResult.denom10 = sisa;
                    d10 -= sisa;
                    tempResult.total = tempResult.denom100 + tempResult.denom50 + tempResult.denom20 + tempResult.denom10 + tempResult.denom5 + tempResult.denom2;
                    result.Add(tempResult);
                    sisa                  = limitDelivery;
                    tempResult            = new DataProses();
                    tempResult.sumberDana = sumberDana;
                    tempResult.tujuan     = vault;
                    tempResult.keterangan = keterangan;
                }
            }
            if (d10 > 0)
            {
                tempResult.denom10 = d10;
                sisa -= d10;
            }
            //5K
            if (d5 > sisa)
            {
                while (d5 > sisa)
                {
                    tempResult.denom5 = sisa;
                    d5 -= sisa;
                    tempResult.total = tempResult.denom100 + tempResult.denom50 + tempResult.denom20 + tempResult.denom10 + tempResult.denom5 + tempResult.denom2;
                    result.Add(tempResult);
                    sisa                  = limitDelivery;
                    tempResult            = new DataProses();
                    tempResult.sumberDana = sumberDana;
                    tempResult.tujuan     = vault;
                    tempResult.keterangan = keterangan;
                }
            }
            if (d5 > 0)
            {
                tempResult.denom5 = d5;
                sisa -= d5;
            }
            //2K
            if (d2 > sisa)
            {
                while (d2 > sisa)
                {
                    tempResult.denom2 = sisa;
                    d2 -= sisa;
                    result.Add(tempResult);
                    sisa                  = limitDelivery;
                    tempResult            = new DataProses();
                    tempResult.sumberDana = sumberDana;
                    tempResult.tujuan     = vault;
                    tempResult.keterangan = keterangan;
                }
            }
            if (d2 > 0)
            {
                tempResult.denom2 = d2;
                sisa -= d2;
            }
            if (tempResult.denom100 + tempResult.denom50 + tempResult.denom20 + tempResult.denom10 + tempResult.denom5 + tempResult.denom2 > 0)
            {
                tempResult.total = tempResult.denom100 + tempResult.denom50 + tempResult.denom20 + tempResult.denom10 + tempResult.denom5 + tempResult.denom2;
                result.Add(tempResult);
            }
        }
Exemplo n.º 3
0
        private void Fill()
        {
            string order = "Nama, NoCustomer";

            string nStatus = "";

            if (StatusA != "")
            {
                nStatus = " AND Status = 'A'";
            }
            if (StatusI != "")
            {
                nStatus = " AND Status = 'I'";
            }

            string Sifat = "";

            if (nSifat == "sifatSUDAH")
            {
                Sifat = " AND (SELECT COUNT(*) FROM MS_KONTRAK WHERE NoCustomer = MS_CUSTOMER.NoCustomer) <> 0";
            }
            if (nSifat == "sifatBELUM")
            {
                Sifat = " AND (SELECT COUNT(*) FROM MS_KONTRAK WHERE NoCustomer = MS_CUSTOMER.NoCustomer) = 0";
            }

            //change parameter
            string str = String.Empty;

            str = Nama.Replace("-", "").ToLower();
            char[] characters = str.ToCharArray();
            string str2       = "";

            foreach (var t in characters)
            {
                str2 += "'" + t + "',";
            }
            str2 = str2.TrimEnd(',');

            //change parameter
            string stragama = String.Empty;

            stragama = Agama.Replace("-", "").ToLower();


            string aq = "";

            if (Nama != "")
            {
                aq = aq + " AND LEFT(Nama,1) IN (" + str2 + ")";
            }


            string nInput = "";

            if (Input != "SEMUA")
            {
                string[] z = Input.Split('-');
                nInput = " AND YEAR(TglInput) = " + z[0]
                         + " AND MONTH(TglInput) = " + z[1];
            }

            string Lahir = "";

            if (nLahir != "SEMUA")
            {
                order = " DAY(TglLahir), Nama";
                Lahir = " AND MONTH(TglLahir) = " + nLahir;
            }

            string AgentInput = "";

            if (nAgentInput != "SEMUA")
            {
                AgentInput = " AND AgentInput = '" + nAgentInput + "'";
            }

            string nProject = "";

            if (Project != "SEMUA")
            {
                nProject = " AND Project IN ('" + Project.Replace(",", "','") + "')";
            }

            string strdata = String.Empty;

            string [] str3 = SumberData.Split('-');
            for (int i = 0; i < str3.Length; i++)
            {
                if (i == str3.Length - 1)
                {
                    strdata += "'" + str3[i] + "'";
                }
                else
                {
                    strdata += "'" + str3[i] + "',";
                }
            }
            //nSumberData = nSumberData.TrimEnd('-');
            //nSumberData = nSumberData.Replace("-", "','");
            //nSumberData = "'" + nSumberData;

            //string nSumberData2 = nSumberData;
            //nSumberData2 = nSumberData + "'";

            string stringAgama = Agama;

            stringAgama = stringAgama.TrimEnd('-');
            stringAgama = stringAgama.Replace("-", "','");
            stringAgama = "'" + stringAgama;

            string agama = stringAgama;

            agama = stringAgama + "'";

            string strSql = "SELECT *"
                            + ",CASE (SELECT COUNT(*) FROM MS_KONTRAK WHERE NoCustomer = MS_CUSTOMER.NoCustomer)"
                            + "		WHEN 0 THEN 'BELUM BELI'"
                            + "		ElSE 'SUDAH BELI'"
                            + " END AS Sifat"
                            + " FROM MS_CUSTOMER"
                            + " WHERE "
                            + " SumberData IN (" + strdata + ")"
                            //+ " AND Agama IN (" + agama + ")"
                            + nProject
                            + nStatus
                            + aq
                            + nInput
                            + Lahir
                            + AgentInput
                            + Sifat
                            + " ORDER BY " + order
            ;
            DataTable rs = Db.Rs(strSql);

            for (int i = 0; i < rs.Rows.Count; i++)
            {
                if (!Response.IsClientConnected)
                {
                    break;
                }

                TableRow  r = new TableRow();
                TableCell c;

                r.VerticalAlign            = VerticalAlign.Top;
                r.Attributes["ondblclick"] = "popEditCustomer('" + rs.Rows[i]["NoCustomer"] + "')";

                r.VerticalAlign            = VerticalAlign.Top;
                r.Attributes["ondblclick"] = "popEditCustomer('" + rs.Rows[i]["NoCustomer"] + "')";
                c                 = new TableCell();
                c.Text            = (i + 1).ToString() + ".";
                c.HorizontalAlign = HorizontalAlign.Left;
                r.Cells.Add(c);

                string inaktif = "";
                if (rs.Rows[i]["Status"].ToString() == "I")
                {
                    inaktif = " **";
                }

                c                 = new TableCell();
                c.Text            = rs.Rows[i]["Nama"].ToString();
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                c                 = new TableCell();
                c.Text            = rs.Rows[i]["TipeCs"].ToString();
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                c                 = new TableCell();
                c.Text            = rs.Rows[i]["SumberData"].ToString();
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                c = new TableCell();
                string    unit    = "SELECT NoUnit FROM MS_KONTRAK WHERE NoCustomer = '" + rs.Rows[i]["NoCustomer"].ToString() + "'";
                DataTable rsUnit  = Db.Rs(unit);
                string    addUnit = "";
                for (int j = 0; j < rsUnit.Rows.Count; j++)
                {
                    addUnit = rsUnit.Rows[j]["NoUnit"] + ", ";
                }
                if (addUnit != "")
                {
                    addUnit = addUnit.Substring(0, addUnit.Length - 2);
                }
                c.Text            = addUnit;
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                c                 = new TableCell();
                c.Text            = rs.Rows[i]["AgentInput"].ToString();
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                c                 = new TableCell();
                c.Text            = rs.Rows[i]["NamaBisnis"].ToString();
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                c                 = new TableCell();
                c.Text            = rs.Rows[i]["JenisBisnis"].ToString();
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                c                 = new TableCell();
                c.Text            = rs.Rows[i]["MerekBisnis"].ToString();
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                c                 = new TableCell();
                c.Text            = rs.Rows[i]["Agama"].ToString();
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                c                 = new TableCell();
                c.Text            = Cf.Day(rs.Rows[i]["TglLahir"]);
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                c                 = new TableCell();
                c.Text            = rs.Rows[i]["NoTelp"].ToString();
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                c                 = new TableCell();
                c.Text            = rs.Rows[i]["NoHP"].ToString();
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                c                 = new TableCell();
                c.Text            = rs.Rows[i]["NoKantor"].ToString();
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                c                 = new TableCell();
                c.Text            = rs.Rows[i]["NoFax"].ToString();
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                c                 = new TableCell();
                c.Text            = rs.Rows[i]["Email"].ToString();
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                c                 = new TableCell();
                c.Text            = rs.Rows[i]["NoKTP"].ToString();
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                c      = new TableCell();
                c.Text = rs.Rows[i]["Alamat1"] + "&nbsp;"
                         + rs.Rows[i]["Alamat2"] + "&nbsp;"
                         + rs.Rows[i]["Alamat3"] + "&nbsp;"
                ;
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                c      = new TableCell();
                c.Text = rs.Rows[i]["KTP1"] + "&nbsp;"
                         + rs.Rows[i]["KTP2"] + "&nbsp;"
                         + rs.Rows[i]["KTP3"] + "&nbsp;"
                         + rs.Rows[i]["KTP4"] + "&nbsp;"
                ;
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                c                 = new TableCell();
                c.Text            = rs.Rows[i]["NPWP"].ToString();
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                c      = new TableCell();
                c.Text = rs.Rows[i]["NPWPAlamat1"] + "&nbsp;"
                         + rs.Rows[i]["NPWPAlamat2"] + "&nbsp;"
                         + rs.Rows[i]["NPWPAlamat3"] + "&nbsp;"
                ;
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                c                 = new TableCell();
                c.Text            = rs.Rows[i]["Sifat"].ToString();
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                if (rs.Rows[i]["Sifat"].ToString() == "SUDAH BELI")
                {
                    PrintSales((int)rs.Rows[i]["NoCustomer"], r);
                }
                else
                {
                    c            = new TableCell();
                    c.Text       = "";
                    c.ColumnSpan = 5;
                    c.Wrap       = false;
                    r.Cells.Add(c);
                }

                c                 = new TableCell();
                c.Text            = Cf.Day(rs.Rows[i]["TglInput"]);
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                c                 = new TableCell();
                c.Text            = Cf.Day(rs.Rows[i]["TglTransaksi"]);
                c.HorizontalAlign = HorizontalAlign.Left;
                c.Wrap            = false;
                r.Cells.Add(c);

                c                 = new TableCell();
                c.Text            = Db.SingleString("SELECT Nama FROM " + Mi.DbPrefix + "SECURITY..REF_PROJECT WHERE Project = '" + rs.Rows[i]["Project"].ToString() + "'");
                c.HorizontalAlign = HorizontalAlign.Left;
                c.VerticalAlign   = VerticalAlign.Top;
                r.Cells.Add(c);

                rpt.Rows.Add(r);
            }
        }