예제 #1
0
        private void BtnSearch_Click(object sender, EventArgs e)
        {
            BargainSuccessRepository bargainSuccessRepository = new BargainSuccessRepository();

            utility.UtilityRepository utility = new utility.UtilityRepository();
            DateTime dateTime_Start_Org       = utility.ShamsiTOMiladi(txtDateStart.Value.ToString("yyyy/MM/dd"));
            DateTime dateTime_End_Org         = utility.ShamsiTOMiladi(txtDateEnd.Value.ToString("yyyy/MM/dd"));
            DateTime dStart = new DateTime(dateTime_Start_Org.Year, dateTime_Start_Org.Month, dateTime_Start_Org.Day, 0, 0, 0);
            DateTime dEnd   = new DateTime(dateTime_End_Org.Year, dateTime_End_Org.Month, dateTime_End_Org.Day, 23, 59, 59);

            List <BargainSuccessViewModel> successViewModels = bargainSuccessRepository.GetAllOpenSellBuy(dStart, dEnd);

            lblSum.Text             = $"جمع مبالغ معاملات باز : {(successViewModels.Sum(x => x.Price) * 1000).ToString("N0")} تومان";
            dgv.AutoGenerateColumns = false;
            dgv.DataSource          = successViewModels;
        }
예제 #2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            using (Repository.ComisonRepository comisonRepository = new Repository.ComisonRepository())
            {
                utility.UtilityRepository utility = new utility.UtilityRepository();
                DateTime dateTime_Start_Org       = utility.ShamsiTOMiladi(txtDateStart.Value.ToString("yyyy/MM/dd"));
                DateTime dateTime_End_Org         = utility.ShamsiTOMiladi(txtDateEnd.Value.ToString("yyyy/MM/dd"));
                DateTime dStart = new DateTime(dateTime_Start_Org.Year, dateTime_Start_Org.Month, dateTime_Start_Org.Day, 0, 0, 0);
                DateTime dEnd   = new DateTime(dateTime_End_Org.Year, dateTime_End_Org.Month, dateTime_End_Org.Day, 23, 59, 59);



                List <Models.Consion> consions = comisonRepository.Search(dStart, dEnd);
                dataGridView1.AutoGenerateColumns = false;

                dataGridView1.DataSource = consions;
                label1.Text = $"جمع کل کمسیون ها : {consions.Sum(x => x.Price).ToString("N0")} تومان";
            }
        }
        private void Button1_Click(object sender, EventArgs e)
        {
            utility.UtilityRepository utility = new utility.UtilityRepository();
            DateTime dateTime_Start_Org       = utility.ShamsiTOMiladi(txtDateStart.Value.ToString("yyyy/MM/dd"));
            DateTime dateTime_End_Org         = utility.ShamsiTOMiladi(txtDateEnd.Value.ToString("yyyy/MM/dd"));
            DateTime dStart = new DateTime(dateTime_Start_Org.Year, dateTime_Start_Org.Month, dateTime_Start_Org.Day, 0, 0, 0);
            DateTime dEnd   = new DateTime(dateTime_End_Org.Year, dateTime_End_Org.Month, dateTime_End_Org.Day, 23, 59, 59);

            Repository.TransactionRepository transactionRepository = new Repository.TransactionRepository();

            var tmp = transactionRepository.Search(dStart, dEnd).OrderByDescending(x => x.Id);

            List <ViewModels.TransactionViewModel> TransactionViewModel_list = new List <ViewModels.TransactionViewModel>();

            long _variz = 0, _bardasht = 0;

            foreach (var item in tmp)
            {
                ViewModels.TransactionViewModel model_tr = new ViewModels.TransactionViewModel();
                model_tr.DateTime = utility.Convert2Shamsi(item.DateTime);
                model_tr.Disc     = item.Disc;
                model_tr.Price    = item.Price;
                model_tr.Name     = item.UserBargain.Name + " " + item.UserBargain.Family;
                if (item.TransactionType_Id == 1)
                {
                    model_tr.TypeName = "واریز";
                    _variz           += item.Price;
                }
                else
                {
                    model_tr.TypeName = "برداشت";
                    _bardasht        += item.Price;
                }
                TransactionViewModel_list.Add(model_tr);
            }// end for

            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource          = TransactionViewModel_list;
            lblVariz.Text    = "جمع واریزی : " + _variz.ToString("N0");
            lblBardasht.Text = "جمع برداشتی : " + _bardasht.ToString("N0");
            lblTotal.Text    = "جمع کل  : " + (_variz - _bardasht).ToString("N0");
        }
        private void BtnSearch_Click(object sender, EventArgs e)
        {
            BargainSuccessRepository bargainSuccessRepository = new BargainSuccessRepository();

            utility.UtilityRepository utility = new utility.UtilityRepository();
            DateTime dateTime_Start_Org       = utility.ShamsiTOMiladi(txtDateStart.Value.ToString("yyyy/MM/dd"));
            DateTime dateTime_End_Org         = utility.ShamsiTOMiladi(txtDateEnd.Value.ToString("yyyy/MM/dd"));
            DateTime dStart = new DateTime(dateTime_Start_Org.Year, dateTime_Start_Org.Month, dateTime_Start_Org.Day, 0, 0, 0);
            DateTime dEnd   = new DateTime(dateTime_End_Org.Year, dateTime_End_Org.Month, dateTime_End_Org.Day, 23, 59, 59);

            List <BargainSuccessViewModel> successViewModels = bargainSuccessRepository.GetAllCloseBag(dStart, dEnd);

            long _myCommision = successViewModels.Sum(x => x.Comision);

            long _mySood  = successViewModels.Where(x => x.Sod >= 0).Sum(x => x.Sod);
            long _myzarar = successViewModels.Where(x => x.Sod < 0).Sum(x => x.Sod);



            lblSumOpen.Text  = $"جمع مبالغ باز شدن : {(successViewModels.Sum(x => x.Price) * 1000).ToString("N0")} تومان";
            lblSumClose.Text = $"جمع مبالغ بسته شدن  : {(successViewModels.Sum(x => x.Price2) * 1000).ToString("N0")} تومان";

            lblSumSood.Text  = $"جمع مبالغ سود با احتساب کارمزد  : {(_mySood).ToString("N0")} تومان";
            lblSumZarar.Text = $"جمع مبالغ ضرر با احتساب کارمزد  : {(_myzarar).ToString("N0")} تومان";

            lblSumSoodOutCommision.Text  = $"جمع مبالغ سود بدون احتساب کارمزد  : {(_mySood-_myCommision).ToString("N0")} تومان";
            lblSumZararOutCommision.Text = $"جمع مبالغ ضرر بدون احتساب کارمزد  : {(_myCommision+_myzarar).ToString("N0")} تومان";



            lblCountBuy.Text  = $"تعداد خرید   : {(successViewModels.Where(x=>x.TypeID==2).Count()).ToString("N0")}";
            lblCountSell.Text = $"تعداد فروش   : {(successViewModels.Where(x=>x.TypeID==1).Count()).ToString("N0")}";
            lblCountAll.Text  = $"تعداد کل   : {(successViewModels.Count()).ToString("N0")}";



            lblSumCommision.Text = $"جمع کارمزدها : {_myCommision.ToString("N0")} تومان";

            dgv.AutoGenerateColumns = false;
            dgv.DataSource          = successViewModels;
        }