Beispiel #1
0
        public DataTable SetData(int ma)
        {
            int i = 0;

            dataSQL = GetNhap(ma);
            DataRow r = data.NewRow();

            if (dataSQL.Tables[1].Rows[i]["MaKH"].ToString() == "0")
            {
                string[] str = dataSQL.Tables[1].Rows[i]["GhiChu"].ToString().Split('_');
                if (str.Length > 1)
                {
                    r["TenKH"] = str[0];
                }
                r["DiaChi"] = str[1];
            }
            else
            {
                r["TenKH"] = dataSQL.Tables[1].Rows[i]["Ten"].ToString();

                r["DiaChi"] = dataSQL.Tables[1].Rows[i]["DiaChi"].ToString();
            }
            r["LyDo"]    = dataSQL.Tables[1].Rows[i]["LyDo"];
            r["SoTien"]  = dataSQL.Tables[1].Rows[i]["TongTien"];
            r["TienChu"] = XL_DOC_SO.DOC_SO_CHUOI(double.Parse(dataSQL.Tables[1].Rows[i]["TongTien"].ToString()), "đồng", "0", 0);
            r["KemTheo"] = dataSQL.Tables[1].Rows[i]["KemTheo"];
            r["NgayThu"] = GetDateFormat(dataSQL.Tables[1].Rows[i]["NgayThu"].ToString());
            r["MaHD"]    = dataSQL.Tables[0].Rows[i]["maHD"];
            r["No"]      = dataSQL.Tables[1].Rows[i]["No"];
            r["Co"]      = dataSQL.Tables[1].Rows[i]["Co"];
            data.Rows.Add(r);
            return(data);
        }
Beispiel #2
0
        public DataTable SetData(int ma)
        {
            int i = 0;

            dataSQL = GetXuat(ma);
            for (i = 0; i < dataSQL.Rows.Count; i++)
            {
                DataRow r = data.NewRow();
                r["Ma"]       = dataSQL.Rows[i]["SOHD"];
                r["NgayLap"]  = FormatDay(dataSQL.Rows[i]["NGAYLAP"].ToString());
                r["KH"]       = dataSQL.Rows[i]["TENKH"];
                r["DiaChi"]   = dataSQL.Rows[i]["DIACHI"];
                r["LyDo"]     = dataSQL.Rows[i]["LYDO"];
                r["kho"]      = dataSQL.Rows[i]["TEN"];
                r["No"]       = dataSQL.Rows[i]["NO"];
                r["Co"]       = dataSQL.Rows[i]["CO"];
                r["STT"]      = i + 1;
                r["TenHH"]    = dataSQL.Rows[i]["TENHANGHOA"];
                r["SoLo"]     = dataSQL.Rows[i]["SOLO"];
                r["NgayHH"]   = dataSQL.Rows[i]["NGAYHH"];
                r["DVT"]      = dataSQL.Rows[i]["TENDV"];
                r["SL"]       = dataSQL.Rows[i]["SOLUONG"];
                r["DonGia"]   = dataSQL.Rows[i]["DONGIA"];
                r["Tien"]     = dataSQL.Rows[i]["TIENCOVAT"];
                r["CK"]       = dataSQL.Rows[i]["ChietKhau"];
                r["TongTien"] = dataSQL.Rows[i]["TONGTIEN"];
                r["Chu"]      = XL_DOC_SO.DOC_SO_CHUOI(double.Parse(dataSQL.Rows[i]["TONGTIEN"].ToString()), "đồng", "0", 0);
                data.Rows.Add(r);
            }
            return(data);
        }
Beispiel #3
0
        public void AddCKhau(DataTable dt, int i, ref double _tongtien, ref int stt)
        {
            double TienCK      = 0;
            double TienChuaAVT = int.Parse(dataSQL.Rows[i]["SOLUONG"].ToString()) * double.Parse(dataSQL.Rows[i]["DONGIA"].ToString());

            TienCK = TienChuaAVT * double.Parse(dataSQL.Rows[i]["ChietKhau"].ToString());
            DataRow r = dt.NewRow();

            r["Date"]      = FormatDayHD(dataSQL.Rows[i]["NGAYLAP"].ToString());
            r["TenKH"]     = dataSQL.Rows[i]["TENKH"];
            r["DiaChi"]    = dataSQL.Rows[i]["DIACHI"];
            r["HTTT"]      = "TM";
            r["MaThue"]    = dataSQL.Rows[i]["MST"];
            stt           += 1;
            r["STT"]       = stt;
            r["TenHH"]     = string.Format("Chiết Khấu ({0}%)", double.Parse(dataSQL.Rows[i]["ChietKhau"].ToString()) * 100);
            r["DVT"]       = "";
            r["SL"]        = 0;
            r["DonGia"]    = 0;
            r["ThanhTien"] = -TienCK;
            r["VAT"]       = dataSQL.Rows[i]["VAT"] + "%";
            _tongtien      = _tongtien - TienCK;
            r["TienTra"]   = _tongtien;
            r["TienVAT"]   = _tongtien * double.Parse(dataSQL.Rows[i]["VAT"].ToString()) / 100;
            r["TongTien"]  = _tongtien + _tongtien * double.Parse(dataSQL.Rows[i]["VAT"].ToString()) / 100;
            r["TienChu"]   = XL_DOC_SO.DOC_SO_CHUOI(double.Parse(r["TongTien"].ToString()), "đồng", "0", 0);

            r["TaiKhoan"] = "";
            dt.Rows.Add(r);
        }
Beispiel #4
0
 private void xrTongtien_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
 {
     try
     {
         xrTongtien.Text = XL_DOC_SO.DOC_SO_CHUOI(double.Parse(xrTong.Text), "đồng", "", 0);
     }
     catch (Exception ex) { }
 }
Beispiel #5
0
        public DataTable SetData(int ma)
        {
            int i = 0;

            dataSQL = GetNhap(ma);
            for (i = 0; i < dataSQL.Rows.Count; i++)
            {
                DataRow r = data.NewRow();
                r["Ma"]       = dataSQL.Rows[i]["MA"];
                r["NgayNhap"] = FormatDay(dataSQL.Rows[i]["NGAYNHAP"].ToString());
                r["NCC"]      = dataSQL.Rows[i]["TEN"];
                r["SoHD"]     = dataSQL.Rows[i]["SOHD"];
                r["NgayLap"]  = FormatDay(dataSQL.Rows[i]["NGAYLAP"].ToString());
                r["NhomNCC"]  = dataSQL.Rows[i]["TENNHOM"];
                r["TenKho"]   = dataSQL.Rows[i]["TenKho"];
                r["NgoaiTe"]  = dataSQL.Rows[i]["MALOAINT"];
                r["TyGia"]    = dataSQL.Rows[i]["TYGIA"];
                r["No"]       = dataSQL.Rows[i]["NO"];
                r["Co"]       = dataSQL.Rows[i]["CO"];

                r["Stt"]      = i + 1;
                r["TenHH"]    = dataSQL.Rows[i]["TENHANGHOA"];
                r["SoLo"]     = dataSQL.Rows[i]["MALO"];
                r["NgayHH"]   = dataSQL.Rows[i]["NGAYHH"];
                r["DVT"]      = dataSQL.Rows[i]["TenDV"];
                r["SL"]       = dataSQL.Rows[i]["SOLUONG"];
                r["DonGia"]   = dataSQL.Rows[i]["DONGIANHAP"];
                r["VAT"]      = dataSQL.Rows[i]["VAT"] + "%";
                r["Tien"]     = dataSQL.Rows[i]["TIENCOVAT"];
                r["CK"]       = dataSQL.Rows[i]["CHIETKHAU"];
                r["TongTien"] = dataSQL.Rows[i]["TONGTIEN"];

                r["ThanhToan"] = "";
                r["Chu"]       = XL_DOC_SO.DOC_SO_CHUOI(double.Parse(dataSQL.Rows[i]["TONGTIEN"].ToString()), "đồng", "", 0);
                data.Rows.Add(r);
            }
            return(data);
        }
Beispiel #6
0
        public DataTable GetDataHD(int ma)
        {
            DataTable dt = new DataTable();

            DataColumn[] dc = new DataColumn[] {
                new DataColumn("Date", Type.GetType("System.String")),
                new DataColumn("TenKH", Type.GetType("System.String")),
                new DataColumn("DiaChi", Type.GetType("System.String")),
                new DataColumn("HTTT", Type.GetType("System.String")),
                new DataColumn("MaThue", Type.GetType("System.String")),
                new DataColumn("STT", Type.GetType("System.String")),
                new DataColumn("TenHH", Type.GetType("System.String")),
                new DataColumn("DVT", Type.GetType("System.String")),
                new DataColumn("SL", Type.GetType("System.String")),
                new DataColumn("DonGia", Type.GetType("System.Double")),
                new DataColumn("ThanhTien", Type.GetType("System.Double")),
                new DataColumn("VAT", Type.GetType("System.String")),
                new DataColumn("TienVAT", Type.GetType("System.Double")),
                new DataColumn("TienTra", Type.GetType("System.Double")),
                new DataColumn("TongTien", Type.GetType("System.Double")),

                new DataColumn("TienChu", Type.GetType("System.String")),
                new DataColumn("TaiKhoan", Type.GetType("System.String"))
            };
            dt.Columns.AddRange(dc);
            int    i        = 0;
            int    stt      = 0;
            double TongTien = 0;

            dataSQL = GetXuat(ma);

            for (i = 0; i < dataSQL.Rows.Count; i++)
            {
                DataRow r = dt.NewRow();
                r["Date"]   = FormatDayHD(dataSQL.Rows[i]["NGAYLAP"].ToString());
                r["TenKH"]  = dataSQL.Rows[i]["TENKH"];
                r["DiaChi"] = dataSQL.Rows[i]["DIACHI"];
                r["HTTT"]   = "TM";
                r["MaThue"] = dataSQL.Rows[i]["MST"];
                stt        += 1;
                r["STT"]    = stt;
                if (dataSQL.Rows[i]["DONGIA"].ToString() == "0")
                {
                    r["TenHH"] = "KM: " + dataSQL.Rows[i]["TENHANGHOA"];
                }
                r["TenHH"]  = dataSQL.Rows[i]["TENHANGHOA"] + "(" + dataSQL.Rows[i]["SOLO"] + ";" + dataSQL.Rows[i]["NGAYHH"] + ")";
                r["DVT"]    = dataSQL.Rows[i]["TENDV"];
                r["SL"]     = dataSQL.Rows[i]["SOLUONG"];
                r["DonGia"] = dataSQL.Rows[i]["DONGIA"];
                double TienChuaAVT = int.Parse(dataSQL.Rows[i]["SOLUONG"].ToString()) * double.Parse(dataSQL.Rows[i]["DONGIA"].ToString());
                double TienCK      = TienChuaAVT * double.Parse(dataSQL.Rows[i]["ChietKhau"].ToString());
                r["ThanhTien"] = TienChuaAVT;
                TongTien      += TienChuaAVT;
                r["VAT"]       = dataSQL.Rows[i]["VAT"] + "%";
                //XL_DOC_SO.DOC_SO_CHUOI(double.Parse(dataSQL.Rows[i]["TONGTIEN"].ToString()), "đồng", "0", 0);
                r["TaiKhoan"] = "";
                r["TienTra"]  = TongTien;
                r["TienVAT"]  = TongTien * double.Parse(dataSQL.Rows[i]["VAT"].ToString()) / 100;
                r["TongTien"] = TongTien + TongTien * double.Parse(dataSQL.Rows[i]["VAT"].ToString()) / 100;
                r["TienChu"]  = XL_DOC_SO.DOC_SO_CHUOI(double.Parse(r["TongTien"].ToString()), "đồng", "0", 0);
                dt.Rows.Add(r);
                if (double.Parse(dataSQL.Rows[i]["ChietKhau"].ToString()) != 0)
                {
                    AddCKhau(dt, i, ref TongTien, ref stt);
                }
            }
            ////////set 10 row
            DataRow rtemp = dt.Rows[dt.Rows.Count - 1];

            for (i = dt.Rows.Count - 1; i < 10; i++)
            {
                DataRow r1 = dt.NewRow();

                r1["VAT"]      = rtemp["VAT"];
                r1["TaiKhoan"] = rtemp["TaiKhoan"];
                r1["TienTra"]  = rtemp["TienTra"];
                r1["TienVAT"]  = rtemp["TienVAT"];
                r1["TongTien"] = rtemp["TongTien"];
                r1["TienChu"]  = rtemp["TienChu"];
                dt.Rows.Add(r1);
            }
            return(dt);
        }