示例#1
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();
        }