Пример #1
0
        void KeyF9() 
        {
            gridView1.PostEditor();
            gridView1.UpdateCurrentRow();
            int ctyp = 0;
            if (lookupcustomer.EditValue != null)
            {
                 ctyp = int.Parse(lookupcustomer.GetColumnValue("CUSTOMERTYPE").ToString());
            }
            var frm = new CashCollected();
            frm.iscredit = ctyp == 2;
            frm.ShowDialog();

            if (!frm.issucess)
                return;
            var _paytype = frm.paytype1;
            try
            {
                if (decimal.Parse(txtnetamt.EditValue.ToString()) != 0 || decimal.Parse(txtreturnamt.EditValue.ToString())!= 0)
                {
                    var f = new AmtCollection();
                    var dt = new BLSales().GetSalesInvMain(txtinvoiceno.Text, false, false);
                    DsInventory.SALESMAINRow dr = null;
                    sALESINVDETAILBindingSource.EndEdit();
                    f.Salesinvdetail = dsInventory1.SALESINVDETAIL;
                    if (dt.Rows.Count == 0)
                    {
                        dr = (DsInventory.SALESMAINRow)dt.NewRow();
                    }
                    else
                    {
                        dr = (DsInventory.SALESMAINRow)dt.Rows[0];
                    }
                    dr.SINVNO = txtinvoiceno.Text;
                    dr.CUSTOMERID = lookupcustomer.EditValue == null ? null : lookupcustomer.EditValue.ToString();
                    dr.CUSTNAME = lookupcustomer.EditValue == null ? "Cash" : lookupcustomer.Text;
                    dr.SALESTYPE = "A";
                    if (ctyp == 1)
                        {
                            dr.SALESTYPE = "I";
                            dr.CUSTOMERFIXDISC = int.Parse(cmbclass.GetColumnValue("COMPDISC").ToString());
                            dr.CARDID = txtfileno.EditValue == null? 0: int.Parse(txtfileno.EditValue.ToString());
                            dr.CARDNO = txtvisitno.EditValue == null?0: int.Parse(txtvisitno.EditValue.ToString());
                        }
                        if (ctyp == 2)
                        {
                            dr.SALESTYPE = "C";
                            f.iscredit = true;
                        }
                    dr.SDISC = txtdiscount.EditValue == null ? 0 : decimal.Parse(txtdiscount.EditValue.ToString());
                    dr.TOTALAMT = subtotal.EditValue == null ? 0 : decimal.Parse(subtotal.EditValue.ToString());
                    dr.ROUNDOFF = 0;
                    dr.NETAMT = decimal.Parse(txtnetamt.EditValue.ToString());
                    dr.RECDAMT = 0;
                    dr.SALESMAN = lookupcashier.EditValue == null ? 0 : int.Parse(lookupcashier.EditValue.ToString());
                    dr.DOCTOR = _doctorid;
                    dr.COMPANY = VIRETAILDAL.COMMON.Utils.Company;
                    dr.COMPNAME = Environment.MachineName;
                    dr.SHITFCODE = new BLSales().GetShiftCode();
                    
                    dr.ISSALE = true;
                    if (cutomerpayment.EditValue != null)
                        dr.CARDDISC = int.Parse(cutomerpayment.EditValue.ToString());
                    if (txtrounding.EditValue != null)
                        dr.ROUNDOFF = decimal.Parse(txtrounding.EditValue.ToString()) ;
                    else
                        dr.ROUNDOFF = 0;

                    if (txtreturnamt.EditValue != null)
                        dr.RETURNAMT = decimal.Parse(txtreturnamt.EditValue.ToString());
                    if (cmbclass.EditValue != null)
                        dr.GRADE = cmbclass.Text;
                    if (txtavailble.EditValue != null)
                        dr.AVAILBLEAMT = decimal.Parse(txtavailble.EditValue.ToString());
                    dr.TRANDATE = DateTime.Now;
                    if (cmbclass.EditValue != null)
                    {
                        f.NetAmount = decimal.Parse(txtnetamt.EditValue.ToString()) *
                                      (decimal.Parse(cutomerpayment.EditValue.ToString())/100);
                    }
                    else
                    {
                        f.NetAmount = decimal.Parse(txtnetamt.EditValue.ToString());
                    }
                    f.RecdAmount = f.NetAmount;
                    f.SalesmainRow = dr;
                    f.Paytype = _paytype;
                    f.ShowDialog();
                    if (f._issucess)
                    {
                        var bls = new BLSales();
                        bls.GetNonSaleInv();
                        lookupcustomer.EditValue = null;
                        if (bls.SalesmainRow != null)
                        {
                            txtinvoiceno.Text = bls.SalesmainRow[0].ToString();
                            dsInventory1.SALESINVDETAIL.Clear();
                            dsInventory1.Merge(bls.Salesinvdetail);
                            foreach (DsInventory.SALESINVDETAILRow drs in dsInventory1.SALESINVDETAIL.Rows)
                            {
                                if (!drs.IsEXPDATENull())
                                    drs["EXPDATE1"] = drs.EXPDATE.ToString("MM-yy");
                            }
                            UpdateTotal();
                        }
                        else
                        {
                            DoNew();    
                        }
                        KeyF8(false);
                        LoadSessionUsers();
                    }
                }
            }    
             catch (Exception op)
             {
                 XtraMessageBox.Show(op.ToString(), "POS", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
        }
Пример #2
0
 void KeyF6()
 {
     KeyF8(false);
     lblmutilpleprice.Visible = false;
     if (lblcustomeronhold.Visible == false)
     {
         if (sALESINVDETAILBindingSource.Count > 0)
         {
             new BLSales().DoHold(txtinvoiceno.Text, 1);
             var bl = new BLSales();
             bl.GetNonSaleInv();
             if (bl.SalesmainRow != null)
             {
                 txtinvoiceno.Text= bl.SalesmainRow[0].ToString();
                 dsInventory1.SALESINVDETAIL.Clear();
                 dsInventory1.Merge(bl.Salesinvdetail);
                 foreach (DsInventory.SALESINVDETAILRow dr in dsInventory1.SALESINVDETAIL.Rows)
                 {
                     if (!dr.IsEXPDATENull())
                         dr["EXPDATE1"] = dr.EXPDATE.ToString("MM-yy");
                 }
                 UpdateTotal();
             }
             else
             {
                 DoNew();
             }
             two.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
             lblcustomeronhold.Visible = true;
         }
     }
     else if (lblcustomeronhold.Visible && sALESINVDETAILBindingSource.Count == 0)
     {
         
         LoadHoldedInvoices();
     }
     else if (lblcustomeronhold.Visible && sALESINVDETAILBindingSource.Count > 0)
     {
         new BLSales().DoHold(txtinvoiceno.Text, 1);
         LoadHoldedInvoices();
     }
     //{
     //    XtraMessageBox.Show("You can't hold more than one customer \r\n please finish the sales and call on hold invoice ",
     //                       "POS", MessageBoxButtons.OK, MessageBoxIcon.Information);
     //  //LoadHoldedInvoices();
     //}
 }
Пример #3
0
        private void RetailSales_Load(object sender, EventArgs e)
        {
         
           try{
            if (Utils.Userid == 0)
            {
                var f = new Login();
                f.ShowDialog();
                if (!f.LoginSucess)
                    Close();
            }
            this.InvokeEx((lv => LoadDataSets()));
            barcomp.Caption = Utils.Company;
            if (ClsGetData.GetDailyClosing().Rows.Count == 0)
            {
                var frm = new InitialCash();
                frm.ShowDialog();
            }
            
            barButtonItem14.Caption  = "Shitf Code = " + new BLSales().GetShiftCode();
            // new BLSales().GetShiftCode("POINTS")
            gridControl1.Invalidate();
            validateoff = false;

            //repositoryItemTextEdit4.Mask.EditMask = "\\d+";
            //repositoryItemTextEdit4.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.RegEx;

            txtfileno.Properties.Mask.EditMask = "\\d+";
            txtfileno.Properties.Mask.MaskType = MaskType.RegEx;

            txtvisitno.Properties.Mask.EditMask = "\\d+";
            txtvisitno.Properties.Mask.MaskType = MaskType.RegEx;

            //txtqty.Properties.Mask.EditMask = "\\d+";
            //txtvisitno.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.RegEx;

           NotifyItems = new List<string>();
            //  dsMaster1.Merge(COMMON.ClsGetData.GetItemMastList());
            LoadSessionUsers();

            var bl = new BLSales();
            bl.GetNonSaleInv();
            if (bl.Salesinvdetail != null)
            {
            if (bl.Salesinvdetail.Rows.Count > 0)
            {
                bl.DoHold(bl.SalesmainRow.SINVNO, 1, bl.SalesmainRow.CUSTOMERID, bl.SalesmainRow.CUSTNAME,
                    bl.SalesmainRow.SDISC, bl.SalesmainRow.ROUNDOFF);
            }
            }
        if (LoadHoldedInvoices())
            {
                if (bl.SalesmainRow != null)
                {
                    if (!bl.SalesmainRow.IsSDISCNull())
                    {
                        if(!bl.SalesmainRow.IsCUSTOMERIDNull())
                        {
                            lookupcustomer.EditValue = bl.SalesmainRow.CUSTOMERID;
                            if(!bl.SalesmainRow.IsGRADENull())
                            {
                                cmbclass.EditValue = bl.SalesmainRow.GRADE;
                            }
                            if (!bl.SalesmainRow.IsCARDIDNull())
                            {
                               txtfileno.EditValue  = bl.SalesmainRow.CARDID;
                            }
                            if (!bl.SalesmainRow.IsCARDNONull())
                            {
                                txtvisitno.EditValue = bl.SalesmainRow.CARDNO;
                            }
                            if (!bl.SalesmainRow.IsCUSTNAMENull())
                            {
                                var sp = bl.SalesmainRow.CUSTNAME.Split('-');
                                if (sp.Length > 1)
                                {
                                    txtpatname.Text = sp[1];
                                }
                            }
                        }
                        txtdiscount.EditValue = bl.SalesmainRow.SDISC;
                        subtotal.EditValue = bl.SalesmainRow.TOTALAMT;
                        txtnetamt.EditValue = bl.SalesmainRow.NETAMT;
                    }

                    txtinvoiceno.Caption = bl.SalesmainRow[0].ToString().Trim();
                    dsInventory1.SALESINVDETAIL.Clear();
                    dsInventory1.Merge(bl.Salesinvdetail);
                    foreach (DsInventory.SALESINVDETAILRow dr in dsInventory1.SALESINVDETAIL.Rows)
                    {
                        if (!dr.IsEXPDATENull())
                            dr["EXPDATE1"] = dr.EXPDATE.ToString("MM-yy");
                    }
                    UpdateTotal();
                }
                else
                {
                    txtinvoiceno.Caption = new BLSales().GetInvoiceNo().Trim();
                    DoSave();
                }
            }
            }
            catch(Exception ext)
            {
                 XtraMessageBox.Show(ext.ToString(), "POS", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
          //  SetUpComm();
        }
Пример #4
0
        private void RetailSales_Load(object sender, EventArgs e)
        {
            if (VIRETAILDAL.COMMON.Utils.Userid==0)
            {
                var f = new Login();
                
                f.ShowDialog();
                if(!f.LoginSucess)
                    Close();
                 
            }
           this.InvokeEx((lv => LoadDataSets()));
           barcomp1.Caption = VIRETAILDAL.COMMON.Utils.Company;
           if (ClsGetData.GetDailyClosing().Rows.Count == 0)
           {
               var frm = new InitialCash();
               frm.ShowDialog();
           }
           gridControl1.Invalidate();
           _validateoff =false;

           repositoryItemTextEdit4.Mask.EditMask = "\\d+";
           repositoryItemTextEdit4.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.RegEx;

           txtfileno.Properties.Mask.EditMask = "\\d+";
           txtfileno.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.RegEx;

           txtvisitno.Properties.Mask.EditMask = "\\d+";
           txtvisitno.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.RegEx;


           NotifyItems = new List<string>();
       //  dsMaster1.Merge(COMMON.ClsGetData.GetItemMastList());
           LoadSessionUsers();
          if (LoadHoldedInvoices())
          {
              var bl = new BLSales();
              bl.GetNonSaleInv();
              if (bl.SalesmainRow != null)
              {
                  txtinvoiceno.Text = bl.SalesmainRow[0].ToString();
                  dsInventory1.SALESINVDETAIL.Clear();
                  dsInventory1.Merge(bl.Salesinvdetail);
                  foreach (DsInventory.SALESINVDETAILRow dr in dsInventory1.SALESINVDETAIL.Rows)
                  {
                      if (!dr.IsEXPDATENull())
                          dr["EXPDATE1"] = dr.EXPDATE.ToString("MM-yy");
                  }
                  UpdateTotal();
              }
              else
              {
                  txtinvoiceno.Text = new BLSales().GetInvoiceNo();
                  DoSave();
              }
          }
       }
Пример #5
0
        void KeyF6()
        {
            gridView1.PostEditor();
            gridView1.UpdateCurrentRow();
            string customerid = lookupcustomer.EditValue == null ? null : lookupcustomer.EditValue.ToString();
            string custname = lookupcustomer.EditValue == null ? string.Empty : lookupcustomer.Text;
            decimal sdisc = txtdiscount.EditValue == null ? 0 : decimal.Parse(txtdiscount.EditValue.ToString());
            decimal rounding = txtrounding.EditValue == null ? 0 : decimal.Parse(txtrounding.EditValue.ToString());
            txtcustomer.EditValue = null;
            
            KeyF8(false);
            lblmutilpleprice.Visible = false;
            if (lblcustomeronhold.Visible == false)
            {
                if (sALESINVDETAILBindingSource.Count > 0)
                {

                    new BLSales().DoHold(txtinvoiceno.Caption.Trim(), 1,customerid,custname,sdisc,rounding);
                    var bl = new BLSales();
                    
                    lookupcustomer.EditValue = null;
                    txtdiscount.EditValue = 0;

                  //  DoNew();
                    bl.GetNonSaleInv();

                    if (bl.SalesmainRow != null)
                    {
                        lookupcustomer.EditValue = null;
                        txtfileno.EditValue = null;
                        txtvisitno.EditValue = null;
                        cmbclass.EditValue = null;
                        cutomerpayment.EditValue = null;
                        txtpatname.EditValue = null;
                        txtrounding.EditValue = 0;
                        panelinsurance.Visible = false;
                        panelnormalcustomer.Visible = false;

                        txtinvoiceno.Caption = bl.SalesmainRow[0].ToString();
                        dsInventory1.SALESINVDETAIL.Clear();
                        dsInventory1.Merge(bl.Salesinvdetail);
                        foreach (DsInventory.SALESINVDETAILRow dr in dsInventory1.SALESINVDETAIL.Rows)
                        {
                            if (!dr.IsEXPDATENull())
                                dr["EXPDATE1"] = dr.EXPDATE.ToString("MM-yy");
                        }
                        UpdateTotal();
                        txtbarcode.Focus();
                    }
                    else
                    {
                        DoNew();
                    }
                    two.Visibility = BarItemVisibility.Always;
                    lblcustomeronhold.Visible = true;
                }
            }
            else if (lblcustomeronhold.Visible && sALESINVDETAILBindingSource.Count == 0)
            {
                LoadHoldedInvoices();
            }
            else if (lblcustomeronhold.Visible && sALESINVDETAILBindingSource.Count > 0)
            {
                new BLSales().DoHold(txtinvoiceno.Caption.Trim(), 1, customerid, custname, sdisc, rounding);
                LoadHoldedInvoices();
            }
            //{
            //    XtraMessageBox.Show("You can't hold more than one customer \r\n please finish the sales and call on hold invoice ",
            //                       "POS", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //  //LoadHoldedInvoices();
            //}
        }