Exemplo n.º 1
0
        private bool TinhChuKy(int thang, int nam, int Ngay, int ChuKy, int ngaysau, int chukysau, int kiemtra)
        {
            SYS_Session session = (SYS_Session)Session["SYS_Session"];
            DataTable   dt      = db.SELECT_TONTHAT_CHUKY(session.User.ma_dviqlyDN, cmbMaTram.Value + "", thang, nam, Ngay, ChuKy, ngaysau, chukysau, kiemtra);

            if (dt.Rows.Count == 0)
            {
                return(false);
            }
            if (dt.Rows[0]["CSUAT"] + "" == "0" || dt.Rows[0]["CSUAT"] + "" == "")
            {
                return(false);
            }
            decimal sltinhCK = 0, sanluongtrc = 0;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (i == 0)
                {
                    decimal slg = (decimal.Parse(dt.Rows[i]["SLGCOT"] + "") * decimal.Parse(dt.Rows[i]["CSUAT"] + "")) / decimal.Parse(dt.Rows[i]["SLDAUNGUONG"] + "");
                    sanluongtrc = decimal.Parse(dt.Rows[i]["SLGCOT"] + "");
                    sltinhCK    = slg;
                    db.INSERT_TTTT_SLGNUT_CHUKY(session.User.ma_dviqlyDN, cmbMaTram.Value + "", dt.Rows[i]["MACOT"] + "", thang, nam, Math.Round(slg, 2), Ngay, ChuKy);
                }
                else
                {
                    decimal slg = sltinhCK * decimal.Parse(dt.Rows[i]["SLGCOT"] + "") / sanluongtrc;
                    sanluongtrc = decimal.Parse(dt.Rows[i]["SLGCOT"] + "");
                    sltinhCK    = slg;
                    db.INSERT_TTTT_SLGNUT_CHUKY(session.User.ma_dviqlyDN, cmbMaTram.Value + "", dt.Rows[i]["MACOT"] + "", thang, nam, Math.Round(slg, 2), Ngay, ChuKy);
                }
            }
            return(true);
        }
Exemplo n.º 2
0
        private bool TinhChuKy(string ma_dviqlyDN, string MaTram, int thang, int nam, int Ngay, int ChuKy, int ngaysau, int chukysau, int kiemtra)
        {
            DataAccess.clTTTT db = new DataAccess.clTTTT();

            DataTable dt = db.SELECT_TONTHAT_CHUKY(ma_dviqlyDN, MaTram + "", thang, nam, Ngay, ChuKy, ngaysau, chukysau, kiemtra);

            if (dt.Rows.Count == 0)
            {
                return(false);
            }
            if (dt.Rows[0]["CSUAT"] + "" == "0" || dt.Rows[0]["CSUAT"] + "" == "")
            {
                return(false);
            }
            decimal sltinhCK = 0, sanluongtrc = 0;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (i == 0)
                {
                    decimal slg = (decimal.Parse(dt.Rows[i]["SLGCOT"] + "") * decimal.Parse(dt.Rows[i]["CSUAT"] + "")) / decimal.Parse(dt.Rows[i]["SLDAUNGUONG"] + "");
                    sanluongtrc = decimal.Parse(dt.Rows[i]["SLGCOT"] + "");
                    sltinhCK    = slg;
                    db.INSERT_TTTT_SLGNUT_CHUKY(ma_dviqlyDN, MaTram + "", dt.Rows[i]["MACOT"] + "", thang, nam, Math.Round(slg, 2), Ngay, ChuKy);
                }
                else
                {
                    decimal slg = sltinhCK * decimal.Parse(dt.Rows[i]["SLGCOT"] + "") / sanluongtrc;
                    sanluongtrc = decimal.Parse(dt.Rows[i]["SLGCOT"] + "");
                    sltinhCK    = slg;
                    db.INSERT_TTTT_SLGNUT_CHUKY(ma_dviqlyDN, MaTram + "", dt.Rows[i]["MACOT"] + "", thang, nam, Math.Round(slg, 2), Ngay, ChuKy);
                }
            }
            return(true);
        }