示例#1
0
        public void CreateItemMoveFrmPr(DsPurchase.PURCHASEREQUESTDataTable dt,string whid)
        {
            var dsStore = ClsGetData.GetStoreList();
            var dr1= dsStore.Select ("COMPANY = '" + Utils.Company + "'");
            var dr = dr1[0];
            var bl = new Blitemmove();
          
            lookupfrom.EditValue = dr[0].ToString();
            lookupto.EditValue = whid;
            bl.CreateItemtransferdetailsFrmMr(dt, dr[0].ToString());

            //foreach (DsInventory.ITEMTRANSFERDETAILRow drn in bl.Itemtransferdetail)
            //{
            //    var nr = dsInventory1.ITEMTRANSFERDETAIL.NewRow();
            //    dsInventory1.ITEMTRANSFERDETAIL.Rows.Add(nr);
            //}
           // gridControl1.DataSource = bl.Itemtransferdetail;
              dsInventory1.Merge(bl.Itemtransferdetail);
        }
示例#2
0
 bool DoSave()
 {
     gridView1.PostEditor();
     gridView1.UpdateCurrentRow();
     bool retval = false;
     if (lookupfrom.EditValue == lookupto.EditValue)
     {
         XtraMessageBox.Show("Please select correct locations", "POS", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return false;
     }
     if (dsInventory1.ITEMTRANSFERDETAIL.Count == 0)
     {
         XtraMessageBox.Show("Nothing to save", "POS", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return false;
     }
     if (!_isHold)
     {
         if (int.Parse(lookupto.GetColumnValue("COMM").ToString()) == 3)
         {
             if (lookupto.GetColumnValue("COMPANY").ToString() != lookupfrom.GetColumnValue("COMPANY").ToString())
             {
                 XtraMessageBox.Show("Internal transfer not possible for different companies", "POS",
                                     MessageBoxButtons.OK, MessageBoxIcon.Information);
                 return false;
             }
         }
         ItemMoveHasErrors();
         if (dsInventory1.ITEMTRANSFERDETAIL.HasErrors)
         {
             XtraMessageBox.Show("Document not saved due to error, please check the errors", "POS",
                                 MessageBoxButtons.OK, MessageBoxIcon.Error);
             return false;
         }
         //if (ValidateSalesHold())
         //    return false;
     }
     var dr = (DsInventory.ITEMTRANSFERMAINRow)dsInventory1.ITEMTRANSFERMAIN.NewRow();
     //if (!string.IsNullOrEmpty(_tranid))
     dr.TRANID = _tranid;
     dr.COMPANY = Utils.Company;
     dr.FRMSTOREID =lookupfrom.EditValue.ToString();
     dr.TOSTOREID  = lookupto.EditValue.ToString();
     dr.TRANDATE = dateEdit1.DateTime;
     dr.TOTVALUE = GetTotal();
     dr.HOLD = _isHold;
     dr.USERID = Utils.Userid;
     dr.FRMNAME = lookupfrom.Text;
     dr.TONAME = lookupto.Text;
     dr.TTYPE = int.Parse(lookupto.GetColumnValue("COMM").ToString());
     dr.TOCOMP = lookupto.GetColumnValue("COMPANY").ToString();
     var stype = lookupto.GetColumnValue("STORETYPE").ToString().Substring(0,1);
     var bhl = new Blitemmove {ItemtransfermainRow = dr,Stype = stype};
     ShorcutKeysDisbale = !_isHold;
     gridView1.PostEditor();
     gridView1.UpdateCurrentRow();
     iTEMTRANSFERDETAILBindingSource.EndEdit();
     var changes = (DsInventory.ITEMTRANSFERDETAILDataTable)dsInventory1.ITEMTRANSFERDETAIL.GetChanges(DataRowState.Modified | DataRowState.Added);
     bhl.Itemtransferdetail = dsInventory1.ITEMTRANSFERDETAIL;
     try
     {
         var strstatus = bhl.DoSave();
         if (strstatus == "1")
         {
             _tranid = bhl.Tranid;
             txtpurno.Text = _tranid;
             RibbonSaveEnable = false;
             HoldButtonVisibility = BarItemVisibility.Never; 
             XtraMessageBox.Show("Data Saved Sucessfully", "POS", MessageBoxButtons.OK, MessageBoxIcon.Information);
             foreach (DataRow d in dsInventory1.ITEMTRANSFERDETAIL.Rows)
             {
                 if (d.RowState != DataRowState.Deleted)
                 {
                     d["TRANID"] = bhl.Tranid;
                 }
             }
             var addedRows = from row in dsInventory1.ITEMTRANSFERDETAIL
                             where row.RowState == DataRowState.Added
                             select row;
             foreach (var row in addedRows.ToArray())
             {
                 row.Delete();
             }
             if (changes != null) dsInventory1.Merge(changes);
             dsInventory1.AcceptChanges(); 
             retval = true;
         }
         else
         {
             XtraMessageBox.Show(strstatus,"POS",MessageBoxButtons.OK,MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.ToString());
     }
     SaveRequired = !retval;
     return retval;
 }
示例#3
0
        private void FetchServerData()
        {
            tranids = string.Empty;
            progressPanel1.Visible = true;
            Application.DoEvents();
           _dsdownload.Clear();
           string cnstr = new SqlAsyncConnectionString(6, true);
       //  string _syncConstr = new SqlAsyncConnectionString(6, true);
           if (Utils.Company == "01" || Utils.Company == "00")
           {
               cnstr = Utils.ConnectionstringSync;//_constr = VIRETAILDAL.COMMON.Utils.Connectionstring;
           }
           var bl = new ItemDownLoadDataManager();
            try
            {
                string maxtran = new Blitemmove().GetMaxTranid();
               _negativestockmaster = bl.GetNegativeStock();

                bl.GetServerData(ref _ds, cnstr, maxtran);
                if (DoStartPusingData(true))
                {
                   ////////new RemoteSync().UpDateRemoteTransferMain(_ds.ITEMTRANSFERMAIN);
                   XtraMessageBox.Show("Down load finish", "POS", MessageBoxButtons.OK,MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.ToString());
            }
        }
示例#4
0
        public void DoView(bool hideribbon=false,bool useoother=false,string concomp = "")
        {
            if (!string.IsNullOrEmpty(_tranid))
            {
                var bl = new Blitemmove { Tranid = _tranid };
                bl.GetItemMoveByTranid(useoother,concomp);
                bsW.Filter = "";
                txtpurno.Text = _tranid;
                dateEdit1.EditValue = bl.Trandate;
                lookupfrom.EditValue = bl.FromId;
                lookupto.EditValue = bl.ToId;
                memoEdit1.EditValue = bl.Notes;
                ShorcutKeysDisbale =  !bl.Hold;
                if (dsInventory1.ITEMTRANSFERDETAIL.Rows.Count > 0)
                {
                    dsInventory1.ITEMTRANSFERDETAIL.Clear();
                    dsInventory1.Merge(bl.Itemtransferdetail);
                }
                else
                {
                    dsInventory1.Merge(bl.Itemtransferdetail);
                }
                if(!bl.Hold)
                {
                    SaveButtonEnable = false;
                    SaveandNewButtonEnable = false;
                    SaveandcloseButtonEnable = false;

                     HoldButtonVisibility = BarItemVisibility.Never;
                   //  ribbon.Hide = true;
                    //ribbon.Visible = false;
                }
            }
        }
示例#5
0
 private void DoSave(bool downall = false)
 {
     if (lookupto.GetColumnValue("COMPANY").ToString() != Utils.Company)
     {
         var dr = _dsdownload.NewRow();
         dr[0] = _ds.ITEMTRANSFERMAIN[0]["TRANID"].ToString();
         dr[1] = _ds.ITEMTRANSFERMAIN[0]["TRANDATE"].ToString();
         dr[2] = _ds.ITEMTRANSFERMAIN[0]["FRMNAME"].ToString();
         dr[3] = "File not belongs your store";
         _dsdownload.Rows.Add(dr);
         return;
     }
     btnbrowse.Enabled = false;
     btnsave.Enabled = false;
     var blitemmove = new Blitemmove();
     foreach (DataRow d in _ds.ITEMTRANSFERMAIN.Rows)
     {
         blitemmove.Tranid = d["TRANID"].ToString();
         if (d["TOCOMP"].ToString() != Utils.Company)
         {
             var dr = _dsdownload.NewRow();
             //dr[0] = _ds.ITEMTRANSFERMAIN[0]["TRANID"].ToString();
             //dr[1] = _ds.ITEMTRANSFERMAIN[0]["TRANDATE"].ToString();
             //dr[2] = _ds.ITEMTRANSFERMAIN[0]["FRMNAME"].ToString();
             dr[0] = d["TRANID"].ToString();
             dr[1] = d["TRANDATE"].ToString();
             dr[2] = d["FRMNAME"].ToString();
             dr[3] = "File not belongs your store";
             _dsdownload.Rows.Add(dr);
         }
         else
         {
             blitemmove.GetItemMoveByTranid();
             if (blitemmove.Itemtransferdetail.Rows.Count > 0)
             {
                 var dr = _dsdownload.NewRow();
                 dr[0] = d["TRANID"].ToString();
                 dr[1] = d["TRANDATE"].ToString();
                 dr[2] = d["FRMNAME"].ToString();
                 dr[3] = "File already download";
                 _dsdownload.Rows.Add(dr);
             }
             else
             {
                 var dr = _dsdownload.NewRow();
                 dr[0] = d["TRANID"].ToString();
                 dr[1] = d["TRANDATE"].ToString();
                 dr[2] = d["FRMNAME"].ToString();
                 var bl = new ItemDownLoadDataManager {whid = lookupto.EditValue.ToString()};
                 var retval = bl.DoSave(_ds, dr[0].ToString(), downall);
                 if (retval == "1")
                 {
                     new RemoteSync().UpDateRemoteTransferMain(dr[0].ToString());
                     tranids += dr[0] + ","; //  SetUpdateFlagInServer()
                     dr[3] = "Data Download Sucessfully";
                     if (_negativestockmaster.Rows.Count > 0)
                     {
                         var f = new FrmNegativeStockReplace {GetDsInventory = _negativestockmaster};
                         f.Show();
                     }
                 }
                 else
                 {
                     dr[3] = "Error" + retval;
                     btnbrowse.Enabled = true;
                     btnsave.Enabled = true;
                 }
                 _dsdownload.Rows.Add(dr);
             }
         }
     }
 }