Пример #1
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            //var ds = new Reports.BLReports().GetDailySales(0m);

            //ds.Select("ctype=1");
            //foreach (DataRow d in ds.Rows)
            //{
            //    txtcash.EditValue = decimal.Parse(d["TOTAL"].ToString());
            //}
            //var d1 = new BusinessLogic.BLDailySales().GetLastClosing();
            //foreach (DataRow dr in d1.Rows)
            //{
            //    if (dr["CTYPE"].ToString() == "1")
            //    {
            //        txttotalcash.EditValue = decimal.Parse(dr["CVALUE"].ToString()) + decimal.Parse(txtcash.EditValue.ToString());
            //    }
            //}
            if (dateEdit2.EditValue != null)
            {
                if (dateEdit1.DateTime.Date < dateEdit2.DateTime.Date)
                {
                    XtraMessageBox.Show("Please check the closing date", "POS", MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    return;
                }
                if (Convert.ToDateTime(dateEdit1.DateTime.Date) == Convert.ToDateTime(dateEdit2.DateTime.Date))
                {
                    XtraMessageBox.Show("Please check the closing date" + Environment.NewLine + "Sales already closed for the selected date" , "POS", MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    return; 
                }
                //  if(DateTime.Compare(dateEdit1.DateTime.Date,dateEdit2.DateTime.Date))
            }
            simpleButton1.Enabled = false;
            DoCloseSale();
            try
            {

                var cls = new PromotionPrice();
                cls.ResetThePromotionPrice(dateEdit1.DateTime.Date);
            }
            catch (Exception et)
            {
              //  XtraMessageBox.Show()
            }
            //Adjust the price change

            //
        }
Пример #2
0
        void DoUploadItemsPrices(bool upload)
        {
            txtstatus.Caption = "Uploading Sales Price";
            Application.DoEvents();
            try
            {
                var dm = new PromotionPrice() ;
                var dt = upload ? dm.GetDataForDownload() : dm.GetDataForUpload();
                var syc = new RemoteSync();
                if (dt.Rows.Count == 0)
                {
                    var drd = _dsdownload.NewRow();
                    drd[0] = "";
                    drd[1] = DateTime.Now.Date;
                    drd[2] = "Promotion Items";
                    drd[3] = "Nothing to Upload ";
                    _dsdownload.Rows.Add(drd);
                }
                else
                {
                        var drd = _dsdownload.NewRow();
                        drd[1] = DateTime.Now.Date;
                        drd[2] = "Promotion Items";
                        var ret = syc.DoUploadPromotionItems(dt, upload);
                        if (ret == "1")
                        {
                            foreach (DataRow dri in dt.Rows)
                            {
                                dm.UpdateSync(int.Parse(dri[0].ToString()));
                            }
                            drd[3] = "Uploaded";
                        }
                        else
                        {
                            drd[3] = "Error  " + ret;
                        }
                        _dsdownload.Rows.Add(drd);
                    }
            }
            catch (Exception exp)
            {
                XtraMessageBox.Show(exp.ToString(), "POS", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

        }
Пример #3
0
 void GetData(string sno)
 {
     ledgers1.PROMOITEMS.Clear();
     var cls = new PromotionPrice();
     var dt = cls.GetDataByBatchNo(int.Parse(sno));
     
     ledgers1.Merge(dt);
     foreach (Ledgers.PROMOITEMSRow dr in ledgers1.PROMOITEMS.Rows)
     {
         dateEdit1.EditValue = dr.STDATE;
         dateEdit2.EditValue = dr.TODATE;
         textEdit1.Text = dr.BATCHNO.ToString();
     }
     
     simpleButton3.Enabled = false;
 }
Пример #4
0
 private void FrmPromotion_Load(object sender, EventArgs e)
 {
     var cls = new PromotionPrice();
     iTEMMASTBindingSource.DataSource =  ClsGetData.GetItemMastList();
     if (Utils.Company == "00" || Utils.Company == "01")
     {
         pROMOITEMS1BindingSource.DataSource = cls.GetPromoBatchNos();
         _Batchno = cls.GetMaxBatchNo();
         _Batchno = _Batchno + 1;
         textEdit1.Text = _Batchno.ToString();
         simpleButton3.Visible = true;
     }
     else
     {
         simpleButton3.Visible = false;
     }
 }
Пример #5
0
        private void simpleButton3_Click(object sender, EventArgs e)
        {
            if (dateEdit1.EditValue == null || dateEdit2.EditValue == null)
            {
                XtraMessageBox.Show("Please select the promotion dates", "POS", MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
                return;
            }
          //  XtraMessageBox.Show("Please check the price of items before updating", "POS", MessageBoxButtons.OK,MessageBoxIcon.Information);
            if (
                XtraMessageBox.Show("Are you sure to update the price", "POS", MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question) == DialogResult.Yes)
            {
                if (!GridValidate())
                {
                    pROMOITEMSBindingSource.EndEdit();
                    var changes = (Ledgers.PROMOITEMSDataTable) ledgers1.PROMOITEMS.GetChanges();
                    var cls = new PromotionPrice();
                    cls.PromoitemsDataTable = ledgers1.PROMOITEMS;

                    var savestatus = cls.DoSave();

                    if (savestatus == "1")
                    {
                        simpleButton3.Enabled = false;
                        XtraMessageBox.Show("Data Saved Sucessfully", "POS", MessageBoxButtons.OK,
                            MessageBoxIcon.Information);

                        var addedRows = from row in ledgers1.PROMOITEMS
                            where row.RowState == DataRowState.Added
                            select row;
                        foreach (var row in addedRows.ToArray())
                        {
                            row.Delete();
                        }

                        if (changes != null) ledgers1.Merge(changes);
                           ledgers1.AcceptChanges();
                    }
                    else
                    {
                        XtraMessageBox.Show(savestatus, "POS", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }