Ejemplo n.º 1
0
        public void BindLinesToPost()
        {
            Cursor.Current = Cursors.WaitCursor;

            ItemJournalDailyLossQH.ItemJournalDailyLossQH_Service itemSev = new QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH_Service();
            itemSev.Url         = WebServiceInstants.GetURL(ServiceType.ItemJournalDailyLossQH);
            itemSev.Credentials = nc;

            ItemJournalDailyLossQH.ItemJournalDailyLossQH[] itemArray = itemSev.ReadMultiple(BatchName, null, null, 0);


            ArrayList values = new ArrayList();

            for (int i = 0; i < itemArray.Length; i++)
            {
                if (!(values.Contains(itemArray[i].Staff_Dimension_Code)))
                {
                    if (itemArray[i].Staff_Dimension_Code != null)
                    {
                        values.Add(itemArray[i].Staff_Dimension_Code);
                    }
                }
            }

            for (int j = 0; j < values.Count; j++)
            {
                cboDailyLPost.Items.Add(values[j].ToString());
            }


            Cursor.Current = Cursors.Default;
        }
Ejemplo n.º 2
0
        private void BindToPost()
        {
            ItemJournalDailyLossQH.ItemJournalDailyLossQH_Service sev = new QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH_Service();
            sev.Credentials = nc;
            sev.Url         = WebServiceInstants.GetURL(ServiceType.ItemJournalDailyLossQH);
            ItemJournalDailyLossQH.ItemJournalDailyLossQH[] journal = sev.ReadMultiple("DEFAULT", null, null, 0);

            for (int i = 0; i < journal.Length; i++)
            {
                Object[] array = new Object[5];

                array[0] = journal[i].Item_No;
                array[1] = journal[i].Location_Code;
                array[2] = journal[i].Bin_Code;
                array[3] = journal[i].Entry_Type;
                array[4] = journal[i].Quantity;
                dtpost.Rows.Add(array);
            }
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        private void menuItem1_Click(object sender, EventArgs e)
        {
            if (GrdDailyLoss.DataSource == 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;

                    for (int i = 0; i < array_daily.Count; i++)
                    {
                        if (array_daily[i].lineNum.Equals("") || array_daily[i].lineNum == 0)
                        {
                            ItemJournalDailyLossQH.ItemJournalDailyLossQH dl = new QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH();

                            dlservice.Create("DOA", ref dl);     // Actual value should be DOA

                            ItemJournalDailyLossQH.ItemJournalDailyLossQH dlupdate = new QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH();
                            dlupdate = dlservice.Read("DOA", dl.Line_No);

                            //added by Hsu 23 april 2013//
                            array_daily[i].lineNum = dl.Line_No;

                            // added by Hsu 23 april 2013 //
                            dlupdate.Posting_Date          = Convert.ToDateTime(array_daily[i].postingDate);
                            dlupdate.Posting_DateSpecified = true;
                            dlupdate.Entry_Type            = ItemJournalDailyLossQH.Entry_Type.Negative_Adjmt;
                            dlupdate.Entry_TypeSpecified   = true;
                            dlupdate.Item_No = array_daily[i].itemno;

                            st = DateTime.Now.ToString("ddMMyyyy");
                            dlupdate.Document_No = st;

                            //dlservice.Update("DOA", ref dlupdate);

                            dlupdate.Quantity             = Convert.ToInt32(array_daily[i].quantity);
                            dlupdate.Location_Code        = array_daily[i].location;
                            dlupdate.Staff_Dimension_Code = staffdim;
                            dlupdate.Bin_Code             = array_daily[i].bincode;

                            dlservice.Update("DOA", ref dlupdate);
                            //array_daily.RemoveAt(i);
                        }

                        CompactSQL comsql = new CompactSQL();
                        comsql.DeleteOneRecord(array_daily[i].sqlLineNum, "DailyLoss");
                    }
                    //// to adjust ////

                    ArrayList tnk = new ArrayList();
                    for (int i = 0; i < array_daily.Count; i++)
                    {
                        if (i == 0)
                        {
                            tnk.Add(array_daily[i].bincode);
                        }
                        else
                        {
                            if (!tnk.Contains(array_daily[i].bincode))
                            {
                                tnk.Add(array_daily[i].bincode);
                            }
                        }
                    }

                    for (int j = 0; j < tnk.Count; j++)
                    {
                        countotal    = 0;
                        flagtemp     = false;
                        itemtemp     = "";
                        locationtemp = "";
                        bincodetemp  = "";

                        for (int k = 0; k < array_daily.Count; k++)
                        {
                            if (tnk[j].ToString().Equals(array_daily[k].bincode))
                            {
                                itemtemp     = array_daily[k].itemno;
                                countotal    = countotal + Convert.ToDecimal(array_daily[k].quantity);
                                locationtemp = array_daily[k].location;
                                bincodetemp  = array_daily[k].bincode;

                                if (array_daily[k].emptyTank == true)
                                {
                                    flagtemp = true;
                                }
                            }
                        }

                        if (flagtemp == true)     //qhbincon[0].Quantity_Base < 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    = "DOA";
                                qhtnk.Item_No       = itemtemp;
                                qhtnk.Location_Code = locationtemp;
                                qhempty.Update(ref qhtnk);
                            }
                        }
                    }

                    //// to adjsut ////

                    //CompactSQL comsql = new CompactSQL();
                    //comsql.deleteRecord("DailyLoss");

                    MessageBox.Show("Submitted.");
                    Cursor.Current          = Cursors.Default;
                    GrdDailyLoss.DataSource = null;
                    this.Close();
                    DailyLoss dlf = new DailyLoss(username, staffdim, userlevel);
                    dlf.Show();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error:" + ex);
                    Cursor.Current = Cursors.Default;
                }
            }
        }
Ejemplo n.º 5
0
        private void btnFind_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            dtPost.Clear();
            GrdPost.DataSource = null;

            ItemJournalDailyLossQH.ItemJournalDailyLossQH_Service itemSev = new QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH_Service();
            itemSev.Url         = WebServiceInstants.GetURL(ServiceType.ItemJournalDailyLossQH);
            itemSev.Credentials = nc;

            List <ItemJournalDailyLossQH.ItemJournalDailyLossQH_Filter> FilterArray = new List <QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH_Filter>();

            ItemJournalDailyLossQH.ItemJournalDailyLossQH_Filter filterStaff = new QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH_Filter();
            filterStaff.Field    = QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH_Fields.Staff_Dimension_Code;
            filterStaff.Criteria = cboDailyLPost.SelectedItem.ToString();



            FilterArray.Add(filterStaff);

            itemArray = itemSev.ReadMultiple(BatchName, FilterArray.ToArray(), null, 0);

            //DateTime[] dateToCompare = new DateTime[itemArray.Length];

            //for (int j = 0; j < itemArray.Length; j++)
            //{
            //    dateToCompare[j] = itemArray[j].Posting_Date;


            //}

            //Array.Sort(dateToCompare);


            //for (int k = 0; k < dateToCompare.Length; k++)
            //{

            for (int i = 0; i < itemArray.Length; i++)
            {
                //DateTime compare1 = dateToCompare[k];
                //DateTime compare2 = itemArray[i].Posting_Date;

                //if (dateToCompare[k].Equals(itemArray[i].Posting_Date))
                //{
                Object[] array = new Object[9];

                array[0] = itemArray[i].Line_No;
                array[1] = itemArray[i].Item_No;
                array[2] = itemArray[i].Description;
                array[3] = itemArray[i].Entry_Type;
                array[4] = itemArray[i].Quantity;
                array[5] = itemArray[i].Location_Code;
                array[6] = itemArray[i].Bin_Code;
                array[7] = itemArray[i].Staff_Dimension_Code;
                array[8] = itemArray[i].Posting_Date;

                dtPost.Rows.Add(array);

                // }
            }
            // }

            GrdPost.DataSource = dtPost;

            lblcountforpost.Text = dtPost.Rows.Count.ToString();

            Cursor.Current = Cursors.Default;
        }
Ejemplo n.º 6
0
        private void btnSaveUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;

                ItemJournalDailyLossQH.ItemJournalDailyLossQH_Service Sev = new QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH_Service();
                Sev.Url         = WebServiceInstants.GetURL(ServiceType.ItemJournalDailyLossQH);
                Sev.Credentials = nc;

                ItemJournalDailyLossQH.ItemJournalDailyLossQH update = Sev.Read(BatchName, Convert.ToInt32(txtLine.Text.Trim()));

                update.Bin_Code             = txtBin.Text.Trim();
                update.Quantity             = Convert.ToInt32(txtQty.Text.Trim());
                update.Staff_Dimension_Code = txtStaffCode.Text.Trim();

                Sev.Update(BatchName, ref update);


                GrdPost.DataSource = null;
                dtPost.Clear();

                List <ItemJournalDailyLossQH.ItemJournalDailyLossQH_Filter> FilterArray = new List <QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH_Filter>();

                ItemJournalDailyLossQH.ItemJournalDailyLossQH_Filter filterStaff = new QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH_Filter();
                filterStaff.Field    = QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH_Fields.Staff_Dimension_Code;
                filterStaff.Criteria = cboDailyLPost.SelectedItem.ToString();

                FilterArray.Add(filterStaff);

                itemArray = Sev.ReadMultiple(BatchName, FilterArray.ToArray(), null, 0);


                for (int i = 0; i < itemArray.Length; i++)
                {
                    Object[] array = new Object[9];

                    array[0] = itemArray[i].Line_No;
                    array[1] = itemArray[i].Item_No;
                    array[2] = itemArray[i].Description;
                    array[3] = itemArray[i].Entry_Type;
                    array[4] = itemArray[i].Quantity;
                    array[5] = itemArray[i].Location_Code;
                    array[6] = itemArray[i].Bin_Code;
                    array[7] = itemArray[i].Staff_Dimension_Code;
                    array[8] = itemArray[i].Posting_Date;
                    dtPost.Rows.Add(array);



                    //Object[] array = new Object[9];
                }

                GrdPost.DataSource = dtPost;

                lblcountforpost.Text = dtPost.Rows.Count.ToString();

                Cursor.Current = Cursors.Default;

                MessageBox.Show("Successfully Updated!");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:" + ex);
            }
        }