示例#1
0
 public void LoadDetails()
 {
     var bl = new Blpurinv { Purinvid = _purinv };
     bl.GetPurinv();
     lookUpEdit2.EditValue = bl.Supid;
     looksupid.EditValue = bl.Supid;
     txtinvno.EditValue = bl.Invno;
     invdate.EditValue = bl.Invdate;
     txtduedays.EditValue = bl.Duedays;
     txtinvamt.EditValue = bl.Netvalue;
 }
示例#2
0
 private void simpleButton1_Click(object sender, EventArgs e)
 {
     if(XtraMessageBox.Show("Do you want to update","POS",MessageBoxButtons.YesNo,MessageBoxIcon.Question)==DialogResult.No)
         return;
     if(!DoValidate()) return;
     var bl = new Blpurinv {Purinvid = _purinv};
     if(looksupid.EditValue==null)
     {
         bl.Supid = lookUpEdit2.EditValue.ToString();
         bl.Supname = lookUpEdit2.Text;
     }
     else
     {
         bl.Supid= looksupid.EditValue.ToString();
         bl.Supname = looksupid.Text;
     }
     bl.Invno = txtinvno.Text;
     bl.Invdate = invdate.DateTime;
     bl.Duedays = int.Parse(txtduedays.EditValue.ToString());
    if( bl.UpdatePurInv() == 0)
    {
        XtraMessageBox.Show("Update error please try again", "POS", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
 }
示例#3
0
         public void  DoView()
         {
             if (!string.IsNullOrEmpty(Purid))
             {
                 var bl = new Blpurinv {Purinvid = Purid};
                 bl.GetPurinv();
                 //dsPurchase1.Merge(bl.Purinvdetail);
                 //pURINVDETAILBindingSource.DataSource = bl.Purinvdetail;
                 txtpurno.Text = Purid;
                 LookupSupplier.EditValue = bl.Supid == "0" ? null : bl.Supid;
                 invno.EditValue = bl.Invno;
                 invdate.EditValue = bl.Invdate;
                 duedays.EditValue = bl.Duedays;
                 spdisc.EditValue = bl.Spdiscount;
                 adjustval.EditValue = bl.Adjvalue;
                 ShorcutKeysDisbale = !bl.Hold;
                 // SaveButtonEnable = !bl.Hold;
                 RibbonSaveEnable = bl.Hold;
                 if (!bl.Hold)
                     HoldButtonVisibility = BarItemVisibility.Never;

                 Lookupwarehouse.EditValue = null;
                 Lookupwarehouse.EditValue = bl.Whid;
                 if (dsPurchase1.PURINVDETAIL.Rows.Count > 0)
                 {
                     dsPurchase1.PURINVDETAIL.Clear();
                     Functions.DeleteBackUp();
                     dsPurchase1.Merge(bl.Purinvdetail);
                     Functions.CreateBackUp(bl.Purinvdetail);
                 }
                 else
                 {
                     dsPurchase1.Merge(bl.Purinvdetail);
                 }
                 UpdateTotals();
                 totnetamt.Tag = bl.Netvalue;
                 totnetamt.EditValue = bl.Netvalue;
                 totspecdisc.EditValue = bl.Spdiscount;
                 foreach (DsPurchase.PURINVDETAILRow d in dsPurchase1.PURINVDETAIL.Rows)
                 {
                     try
                     {
                         if (!d.IsEXPDATENull())
                         {
                             var st = d.EXPDATE.ToString("MM-yy");
                             d.EXPDATE1 = st;
                         }
                     }
                     catch (Exception ex1)
                     {

                         XtraMessageBox.Show(ex1.ToString());
                     }

                 }
             }
         }
示例#4
0
         private bool DoSave()
         {
             if (!IsHold)
             {
                 if (
                     XtraMessageBox.Show("Do you want to save..? \r\n Please check the invoice details before save",
                                         "POS", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                     return false;
                 if (!PurchaseInvoceHasErrors())
                 {
                     XtraMessageBox.Show("Invoice not saved due to errors \r\n please check the errors", "POS",
                                         MessageBoxButtons.OK, MessageBoxIcon.Error);
                     return false;
                 }
             }

             UpdateTotals();
             bool retval = false;
             var dr = (DsPurchase.PURINVMAINRow) dsPurchase1.PURINVMAIN.NewRow();
             if (!string.IsNullOrEmpty(Purid))
              
             dr.PURINVID = Purid;
             dr.COMPANY = Utils.Company;
             dr.SUPID = LookupSupplier.EditValue == null ? null : LookupSupplier.EditValue.ToString();
             dr.SUPNAME = string.IsNullOrWhiteSpace(LookupSupplier.Text) ? null : LookupSupplier.Text;
             dr.INVNO = invno.EditValue == null ? null : invno.EditValue.ToString();
             dr.INVDATE = invdate.DateTime;
             dr.DUEDAYS = duedays.EditValue == null ? 0 : int.Parse(duedays.EditValue.ToString());
             dr.SPDISCOUNT = spdisc.EditValue == null ? 0 : decimal.Parse(spdisc.EditValue.ToString());
             dr.ADJVALUE = adjustval.EditValue == null ? 0 : decimal.Parse(adjustval.EditValue.ToString());
             dr.NETVALUE = totnetamt.EditValue == null ? 0 : decimal.Parse(totnetamt.EditValue.ToString());
             if (string.IsNullOrEmpty(Lookupwarehouse.Text))
                 dr.WHID = null;
             else
                 dr.WHID = Lookupwarehouse.EditValue == null ? null : Lookupwarehouse.EditValue.ToString();
             dr.TRANSTYPE = LookuptoStore.EditValue == null ? null : LookuptoStore.EditValue.ToString();
             // dr.TRANDATE = DateTime.Now;
             dr.HOLD = IsHold;
             dr.USERID = Utils.Userid;
             var bhl = new Blpurinv(dr);
             if (!dr.IsWHIDNull())
             {
                 if (Lookupwarehouse.GetColumnValue("STORETYPE").ToString() == "PS")
                 {
                     bhl.isforsale = true;
                 }
             }
             //if (Lookupwarehouse.Text == "PS")
             //    bhl.isforsale = true;
             advBandedGridView1.PostEditor();
             advBandedGridView1.UpdateCurrentRow();
             //pURINVDETAILBindingSource.ResetBindings(true);
             pURINVDETAILBindingSource.EndEdit();
             var changes = (DsPurchase.PURINVDETAILDataTable) dsPurchase1.PURINVDETAIL.GetChanges();
             bhl.Purinvdetail = dsPurchase1.PURINVDETAIL;
             try
             {
                 var saveStatus = bhl.DoSave();
                 if (saveStatus == "1")
                 {
                     Purid = bhl.Purinvid;
                     txtpurno.Text = Purid;
                     RibbonSaveEnable = false;
                     HoldButtonVisibility = BarItemVisibility.Never;
                     XtraMessageBox.Show("Data Saved Sucessfully", "POS", MessageBoxButtons.OK,
                                         MessageBoxIcon.Information);
                     foreach (DataRow d in dsPurchase1.PURINVDETAIL.Rows)
                     {
                         if (d.RowState != DataRowState.Deleted)
                         {
                             d["PURINVID"] = bhl.Purinvid;
                         }
                     }
                     var addedRows = from row in dsPurchase1.PURINVDETAIL
                                     where row.RowState == DataRowState.Added
                                     select row;
                     foreach (var row in addedRows.ToArray())
                     {
                         row.Delete();
                     }
                     if (changes != null) dsPurchase1.Merge(changes);
                     dsInventory1.AcceptChanges();
                     retval = true;
                     ShorcutKeysDisbale = true;
                     Functions.DeleteBackUp();
                 }
                 else
                 {
                     XtraMessageBox.Show(saveStatus, "POS", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             catch (Exception ex)
             {
                 Functions.CreateBackUp(dsPurchase1.PURINVDETAIL);
                 XtraMessageBox.Show(ex.ToString());
             }
             SaveRequired = !retval;
             return retval;
         }