private void menuItem2_Click(object sender, EventArgs e) { try { QHSalesReceivableSetup.QHSalesReceivableSetup_Service qhSaleSev = new QHMobile.QHSalesReceivableSetup.QHSalesReceivableSetup_Service(); qhSaleSev.Url = WebServiceInstants.GetURL(ServiceType.QHSalesReceivableSetup); qhSaleSev.Credentials = nc; QHSalesReceivableSetup.QHSalesReceivableSetup[] qhBatch = qhSaleSev.ReadMultiple(null, null, 0); if (qhBatch.Length == 0) { MessageBox.Show("There is no batch name found!. Please go and check in NAV!"); } else { BatchName = qhBatch[0].Change_Size_Batch; dtPost.Clear(); cboDailyLPost.Items.Clear(); MnuNewGRN.Enabled = true; BindLinesToPost(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void menuItem1_Click(object sender, EventArgs e) { if (GrdDailyLoss == null) { MessageBox.Show("There is no record to register!"); } else { Cursor.Current = Cursors.WaitCursor; try { decimal countotal = 0; bool flagtemp = false; string itemtemp; string locationtemp; string bincodetemp; ItemJournalDailyLossQH.ItemJournalDailyLossQH_Service dlservice = new QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH_Service(); dlservice.Url = WebServiceInstants.GetURL(ServiceType.ItemJournalDailyLossQH); dlservice.Credentials = nc; QHSalesReceivableSetup.QHSalesReceivableSetup_Service qhsalesev = new QHMobile.QHSalesReceivableSetup.QHSalesReceivableSetup_Service(); qhsalesev.Credentials = nc; qhsalesev.Url = WebServiceInstants.GetURL(ServiceType.QHSalesReceivableSetup); QHSalesReceivableSetup.QHSalesReceivableSetup[] qhsaleGet = qhsalesev.ReadMultiple(null, null, 0); for (int i = 0; i < dl_array.Count; i++) { ItemJournalDailyLossQH.ItemJournalDailyLossQH dl = new QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH(); dlservice.Create(qhsaleGet[0].Change_Size_Batch, ref dl); // Actual value should be DOA dl.Posting_Date = DateTime.Now; if (dl_array[i].entrytype.Equals("Positive Adjmt.")) { dl.Entry_Type = ItemJournalDailyLossQH.Entry_Type.Positive_Adjmt; } else if (dl_array[i].entrytype.Equals("Negative Adjmt.")) { dl.Entry_Type = ItemJournalDailyLossQH.Entry_Type.Negative_Adjmt; } dl.Entry_TypeSpecified = true; dl.Item_No = dl_array[i].itemno; dl.Quantity = Convert.ToInt32(dl_array[i].quantity); dl.Location_Code = dl_array[i].location; //dl.Posting_Date = dl_array[i].postdate; dl.Staff_Dimension_Code = staffdim; dl.Bin_Code = dl_array[i].bincode; dlservice.Update(qhsaleGet[0].Change_Size_Batch, ref dl); } //// to adjust //// ArrayList tnk = new ArrayList(); for (int i = 0; i < dl_array.Count; i++) { if ((dl_array[i].EmptyTank == true) && (dl_array[i].entrytype.Equals("Negative Adjmt."))) { if (i == 0) { tnk.Add(dl_array[i].bincode); } else { if (!tnk.Contains(dl_array[i].bincode)) { tnk.Add(dl_array[i].bincode); } } } } for (int j = 0; j < tnk.Count; j++) { countotal = 0; flagtemp = false; itemtemp = ""; locationtemp = ""; bincodetemp = ""; for (int k = 0; k < dl_array.Count; k++) { if ((dl_array[k].EmptyTank == true) && (dl_array[k].entrytype.Equals("Negative Adjmt."))) { if (tnk[j].ToString().Equals(dl_array[k].bincode)) { itemtemp = dl_array[k].itemno; countotal = countotal + Convert.ToDecimal(dl_array[k].quantity); locationtemp = dl_array[k].location; bincodetemp = dl_array[k].bincode; if (dl_array[k].EmptyTank == true) { flagtemp = true; } } } } //QHBinContent.QHBinContent_Service qhsev = new QHMobile.QHBinContent.QHBinContent_Service(); //qhsev.Credentials = nc; //qhsev.Url = WebServiceInstants.GetURL(ServiceType.QHBinContent); //List<QHBinContent.QHBinContent_Filter> filterArr = new List<QHMobile.QHBinContent.QHBinContent_Filter>(); //QHBinContent.QHBinContent_Filter binfilter = new QHMobile.QHBinContent.QHBinContent_Filter(); //binfilter.Field = QHMobile.QHBinContent.QHBinContent_Fields.Bin_Code; //binfilter.Criteria = bincodetemp; ////QHBinContent.QHBinContent_Filter Qtyfilter = new QHMobile.QHBinContent.QHBinContent_Filter(); ////Qtyfilter.Field = QHMobile.QHBinContent.QHBinContent_Fields.Quantity_Base; ////Qtyfilter.Criteria = "<>0"; //QHBinContent.QHBinContent_Filter itemFilter = new QHMobile.QHBinContent.QHBinContent_Filter(); //itemFilter.Field = QHMobile.QHBinContent.QHBinContent_Fields.Item_No; //itemFilter.Criteria = itemtemp; //filterArr.Add(binfilter); ////filterArr.Add(Qtyfilter); //filterArr.Add(itemFilter); //QHBinContent.QHBinContent[] qhbincon = qhsev.ReadMultiple(filterArr.ToArray(), null, 5); if (flagtemp == true) //qhbincon[0].Quantity_Base < countotal || { // qhfun.TankAdj_NAV(itemtemp, packworksheet, locationtemp, bincodetemp, countotal, flagtemp); //qhfun.TankAdj_NAV(itemtemp, packworksheet, locationtemp, bincodetemp, countotal); QHEmptyTank.QHEmptyTank_Service qhempty = new QHMobile.QHEmptyTank.QHEmptyTank_Service(); qhempty.Url = WebServiceInstants.GetURL(ServiceType.QHEmptyTank); qhempty.Credentials = nc; QHEmptyTank.QHEmptyTank qhcheck = qhempty.Read(bincodetemp); if (qhcheck == null) { QHEmptyTank.QHEmptyTank qhtnk = new QHMobile.QHEmptyTank.QHEmptyTank(); qhtnk.Bin_Code = bincodetemp; qhempty.Create(ref qhtnk); qhtnk.Batch_Name = qhsaleGet[0].Change_Size_Batch; qhtnk.Item_No = itemtemp; qhtnk.Location_Code = locationtemp; qhempty.Update(ref qhtnk); } } //else if (qhbincon[0].Quantity - qhbincon[0].PDA_Inv_Pick_Quantity < countotal) //{ // QH_Functions.QH_Functions qhfun = new QHMobile.QH_Functions.QH_Functions(); // qhfun.Url = WebServiceInstants.GetURL(ServiceType.QH_Functions); // qhfun.Credentials = nc; // decimal updatecount = countotal - (qhbincon[0].Quantity - qhbincon[0].PDA_Inv_Pick_Quantity); // qhfun.InsertIJLPositiveAdjustment(itemtemp, "", locationtemp, bincodetemp, updatecount); // //qhfun.TankAdj_NAV(itemtemp, "", locationtemp, bincodetemp, countotal, flagtemp); //} } //// to adjust //// CompactSQL comsql = new CompactSQL(); comsql.deleteRecord("ChangeSize"); MessageBox.Show("Submitted."); this.Close(); DailyLossTS dilts = new DailyLossTS(staffname, staffdim, stafflevel); dilts.Show(); } catch (Exception ex) { MessageBox.Show("Error:" + ex); } Cursor.Current = Cursors.Default; //DailyLossTS dts = new DailyLossTS(staffname, staffdim, stafflevel); } }