Exemple #1
0
    public void selectPayment()
    {
        try
        {
            Thread.Sleep(500);
            if (ccjob.PaymentID != null && ccjob.PaymentID != "")
            {
                SAPbouiCOM.ComboBox oCB = (SAPbouiCOM.ComboBox)oJobForm.Items.Item(cbPaymentMethod).Specific;
                oCB.Select(ccjob.PaymentID);
            }
            if (JobPaymentID != "")
            {
                SAPbouiCOM.ComboBox oCB = (SAPbouiCOM.ComboBox)oJobForm.Items.Item(cbPaymentMethod).Specific;
                oCB.Select(JobPaymentID);
            }
            if(JobAmount != "")
            {
                setFormEditVal(oJobForm, editCAmount, JobAmount);

            }
            if (ccjob.InvoiceID != 0 && ccjob.InvoiceID != null)
            {
                int id = getDocNum("OINV", ccjob.InvoiceID.ToString());
                setFormEditVal(oJobForm, editInvNo, id.ToString()); ;
            }
            if(ccjob.Frequency != "" && ccjob.Frequency != null)
            {
                SAPbouiCOM.ComboBox oCB = (SAPbouiCOM.ComboBox)oJobForm.Items.Item(cbFrequency).Specific;
                oCB.Select(ccjob.Frequency);
            }
        }catch(Exception ex)
        {
            errorLog(ex);
        }
    }
Exemple #2
0
 public static void Select(ref SAPbouiCOM.ComboBox comboBox, object val, SAPbouiCOM.BoSearchKey boSearchKey)
 {
     if (val != null)
     {
         comboBox.Select(val, boSearchKey);
     }
 }
Exemple #3
0
        private void LoadSchemeCodes()
        {
            SAPbouiCOM.Form oForm = default(SAPbouiCOM.Form);
            try
            {
                oForm = this.CurrentForm;
                oForm.Freeze(true);
                SAPbobsCOM.Recordset oRs  = SBOCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                string sql_GetSchemeCodes = @"select * from ""@AVA_FM_OCRS"" where ""U_Active"" = N'Y' ";
                oRs.DoQuery(sql_GetSchemeCodes);
                SAPbouiCOM.ComboBox cbxSchemes = oForm.Items.Item(CBX_SCHEMECODE).Specific;
                while (cbxSchemes.ValidValues.Count > 0)
                {
                    cbxSchemes.ValidValues.Remove(0, SAPbouiCOM.BoSearchKey.psk_Index);
                }
                for (int iRSRowCounter = 0; iRSRowCounter < oRs.RecordCount; iRSRowCounter++)
                {
                    cbxSchemes.ValidValues.Add(oRs.Fields.Item("Code").Value, oRs.Fields.Item("Name").Value);
                    oRs.MoveNext();
                }
                if (cbxSchemes.ValidValues.Count > 0)
                {
                    cbxSchemes.Select(0, SAPbouiCOM.BoSearchKey.psk_Index);
                    LoadScheme(cbxSchemes.Selected.Value);
                }
            }
            catch (Exception ex) { throw ex; }
            finally { oForm.Freeze(false); }

            #endregion
        }
Exemple #4
0
        private void fillAT(string Cat)
        {
            //ItemType.Clear();
            string animalType = "Select OITM.ItemCode,OITM.ItemName from OITM Inner Join oitt on oitt.Code = oitm.ItemCode where isnull(OITM.U_AnimalType,'N') = '" + Cat + "'";

            System.Data.DataTable dtTypes = Program.objHrmsUI.getDataTable(animalType, "Animal Types");
            int i     = 0;
            int cbCnt = cbAT.ValidValues.Count;

            if (cbCnt > 1)
            {
                for (int k = 1; k < cbCnt; k++)
                {
                    cbAT.ValidValues.Remove(1, SAPbouiCOM.BoSearchKey.psk_Index);
                }
            }
            foreach (System.Data.DataRow dr in dtTypes.Rows)
            {
                // ItemType.Add(dr["ItemCode"].ToString(), dr["ItemName"].ToString());
                cbAT.ValidValues.Add(dr["ItemCode"].ToString(), dr["ItemName"].ToString());
                i++;
            }
            try
            {
                if (i > 0)
                {
                    cbAT.Select(0, SAPbouiCOM.BoSearchKey.psk_Index);
                }
            }
            catch { }
        }
Exemple #5
0
 private void Clear_txts()
 {
     txtYear.Value = "";
     cmbPeriod.Select("SELECCIONE");
     txtNo.Value = "";
     cmbTipo.Select("SELECCIONE");
 }
    private void setComboValue(SAPbouiCOM.Form form, string id, string val)
    {
        string ret = "";

        SAPbouiCOM.ComboBox oItem = null;
        try
        {
            oItem = (SAPbouiCOM.ComboBox)form.Items.Item(id).Specific;
            oItem.Select(val);
        }
        catch (Exception)
        {
        }
        finally
        {
            /*
             * try
             * {
             *  if (oItem != null)
             *      System.Runtime.InteropServices.Marshal.ReleaseComObject(oItem);
             *  oItem = null;
             * }
             * catch (Exception) { }
             */
        }
    }
Exemple #7
0
        private void OutgoingPayments(string pStrBP, string pStrAuction)
        {
            initOutgoingPayments();

            mObjPayRForm.Freeze(true);
            mObjOptB.Item.Click();
            mObjtxtCardCode.Value = pStrBP;
            mObjcbAuxType.Select(1, SAPbouiCOM.BoSearchKey.psk_Index);
            mObjtxtAuctNum.Value = pStrAuction;
            mObjPayRForm.Freeze(false);
        }
Exemple #8
0
        private void InitiallizeForm()
        {
            oForm.Freeze(true);

            initiallizing = true;
            dtNote        = oForm.DataSources.DataTables.Item("dtNote");

            dtDetail = oForm.DataSources.DataTables.Item("dtDetail");

            dtHead = oForm.DataSources.DataTables.Item("dtHead");
            dtHead.Rows.Add(1);

            mtNote   = (SAPbouiCOM.Matrix)oForm.Items.Item("mtNote").Specific;
            mtDetail = (SAPbouiCOM.Matrix)oForm.Items.Item("mtDetail").Specific;

            cbNote  = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbNote").Specific;
            cbValOf = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbValOf").Specific;
            cbCS    = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbCS").Specific;
            cbPRJ   = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbPRJ").Specific;

            txCell    = (SAPbouiCOM.EditText)oForm.Items.Item("txCell").Specific;
            txTxt     = (SAPbouiCOM.EditText)oForm.Items.Item("txTxt").Specific;
            txHCD     = (SAPbouiCOM.EditText)oForm.Items.Item("26").Specific;
            btAddAcct = (SAPbouiCOM.Button)oForm.Items.Item("btAddAcct").Specific;
            btAddFV   = (SAPbouiCOM.Button)oForm.Items.Item("btAddFV").Specific;
            btAddTXT  = (SAPbouiCOM.Button)oForm.Items.Item("btAddTXT").Specific;
            btRemove  = (SAPbouiCOM.Button)oForm.Items.Item("btRemove").Specific;

            txFV = (SAPbouiCOM.EditText)oForm.Items.Item("txFV").Specific;

            fillCb();
            cbValOf.ValidValues.Add("01", "Closing");
            cbValOf.ValidValues.Add("02", "Change");
            cbValOf.ValidValues.Add("03", "Opening");

            cbNote.Select(0, SAPbouiCOM.BoSearchKey.psk_Index);

            cflAcct = (SAPbouiCOM.ChooseFromList)oForm.ChooseFromLists.Item("cflAcct");

            SAPbouiCOM.Conditions oCons = cflAcct.GetConditions();
            SAPbouiCOM.Condition  oCon  = oCons.Add();
            oCon.Alias     = "Postable";
            oCon.Operation = SAPbouiCOM.BoConditionOperation.co_START;
            oCon.CondVal   = "Y";

            cflAcct.SetConditions(oCons);

            oForm.Freeze(false);

            initiallizing = false;
        }
Exemple #9
0
    private string setComboValue(SAPbouiCOM.Form form, string id, string val)
    {
        string ret = "";

        try
        {
            SAPbouiCOM.ComboBox cb = form.Items.Item(id).Specific;
            cb.Select(val);
        }
        catch (Exception)
        {
        }
        return(ret);
    }
        private void UpdateComboBoxField(bool isUDF, string field, object value)
        {
            try{
                var form = isUDF? UDFForm:this.UIAPIRawForm;
                SAPbouiCOM.ComboBox updateField = (SAPbouiCOM.ComboBox)form.Items.Item(field).Specific;
                updateField.Select(value, SAPbouiCOM.BoSearchKey.psk_ByValue);

                //Click the Update Button to Save Changes
                this.UIAPIRawForm.Items.Item(0).Click();
            }
            catch (Exception ex)
            {
                Utilities.StatusbarMessage(string.Concat("ERR: GI.updateField ", ex.ToString()), SAPbouiCOM.BoStatusBarMessageType.smt_Error);
            }
        }
Exemple #11
0
        private void filldetails(string Code)
        {
            string strSelect = "SELECT * FROM \"@B1_QA_ATTR\" WHERE \"Code\" ='" + Code + "'";


            System.Data.DataTable dtRule = Program.objHrmsUI.getDataTable(strSelect, "getting rule detail");
            if (dtRule.Rows.Count > 0)
            {
                string Active = dtRule.Rows[0]["U_Active"].ToString();
                // string baseUnit = dtRule.Rows[0]["BU"].ToString();
                //if (baseUnit == "") baseUnit = "01";

                dtHead.SetValue("Active", 0, Active);
                dtHead.SetValue("Code", 0, Code);
                dtHead.SetValue("Name", 0, dtRule.Rows[0]["U_Descr"].ToString());
                dtHead.SetValue("DefVal", 0, dtRule.Rows[0]["U_DefVal"].ToString());
                dtHead.SetValue("SQL", 0, dtRule.Rows[0]["U_LOVSQL"].ToString());
                dtHead.SetValue("defValid", 0, dtRule.Rows[0]["U_DefValRem"].ToString());

                cbType.Select(dtRule.Rows[0]["U_Type"].ToString());
                cbLOV.Select(dtRule.Rows[0]["U_LOVT"].ToString());
                getLOVList(Code);
            }
        }
Exemple #12
0
 private void FillCustomerType()
 {
     try
     {
         Cmb_CustomerGrp = ((SAPbouiCOM.ComboBox)(theExportSO.Items.Item("cmbCgrp").Specific));
         //ComboAddItem(Cmb_CustomerGrp, "");
         ComboAddItem(Cmb_CustomerGrp, "All");
         List <string> list = GetGroupNames();
         foreach (string c in list)
         {
             ComboAddItem(Cmb_CustomerGrp, c);
         }
         Cmb_CustomerGrp.Select(0, SAPbouiCOM.BoSearchKey.psk_Index);
     }
     catch
     {
     }
 }
Exemple #13
0
        private void fillCbs()
        {
            cbFilter.ValidValues.Add("Status", "Status");
            cbFilter.ValidValues.Add("Product", "Product");

            cbFilter.Select(0, SAPbouiCOM.BoSearchKey.psk_Index);

            SAPbouiCOM.Column ProdLine = mtReport.Columns.Item("cProdLine");
            SAPbouiCOM.Column Label    = mtReport.Columns.Item("cLabel");
            insertProdType();

            string cbDataSql = "Select * from [@PMX_OSPL]";

            System.Data.DataTable cbData = Program.objHrmsUI.getDataTable(cbDataSql, "Get CB Data");
            foreach (System.Data.DataRow dr in cbData.Rows)
            {
                ProdLine.ValidValues.Add(dr["Code"].ToString(), dr["Name"].ToString());
                cbPL.ValidValues.Add(dr["Code"].ToString(), dr["Name"].ToString());
                btPL.ValidValues.Add(dr["Code"].ToString(), dr["Name"].ToString());
            }


            cbPL.Select(0, SAPbouiCOM.BoSearchKey.psk_Index);
            //int cnt = Convert.ToInt32( Program.objHrmsUI.getScallerValue("Select count(*) from [@B1_Label]"));
            //if (cnt == 0)
            //{
            //    insertLabel();

            //}
            //cbDataSql = "Select * from [@B1_Label]";
            //cbData = Program.objHrmsUI.getDataTable(cbDataSql, "Get CB Data");

            //foreach (System.Data.DataRow dr in cbData.Rows)
            //{
            //  // Label.ValidValues.Add(dr["Code"].ToString(), dr["Name"].ToString());
            //}
            Label.ValidValues.Add("", " ");

            Label.ValidValues.Add("Red", "Red");
            Label.ValidValues.Add("Yellow", "Yellow");
            Label.ValidValues.Add("Green", "Green");
            Label.ValidValues.Add("Magenta", "Magenta");
            Label.ValidValues.Add("Orange", "Orange");
        }
Exemple #14
0
        public void ManageSeries(ref SAPbouiCOM.Form oForm, String seriesUID, String headerTable, String docNumUID)
        {
            SAPbouiCOM.ComboBox cbxSeries = oForm.Items.Item(seriesUID).Specific;

            if (oForm.Mode == SAPbouiCOM.BoFormMode.fm_ADD_MODE)
            {
                cbxSeries.ValidValues.LoadSeries(oForm.BusinessObject.Type, SAPbouiCOM.BoSeriesMode.sf_Add);
                cbxSeries.Select("Primary", SAPbouiCOM.BoSearchKey.psk_ByDescription);

                //Getting the next number
                int nextDocNum = oForm.BusinessObject.GetNextSerialNumber("Primary");
                SetValueViaDBS(ref oForm, headerTable, "DocNum", nextDocNum);
            }
            else if (oForm.Mode == SAPbouiCOM.BoFormMode.fm_FIND_MODE)
            {
                cbxSeries.ValidValues.LoadSeries(oForm.BusinessObject.Type, SAPbouiCOM.BoSeriesMode.sf_View);
                SetValueViaDBS(ref oForm, headerTable, "Series", String.Empty);
                oForm.Items.Item(docNumUID).Enabled = true;
            }
        }
        public void LoadAccounts()
        {
            mCmbAcct.Select(0, SAPbouiCOM.BoSearchKey.psk_Index);
            //Remove old valid values
            int lIntValuesLength = mCmbAcct.ValidValues.Count - 1;

            for (int i = 0; i < lIntValuesLength; i++)
            {
                mCmbAcct.ValidValues.Remove(1, SAPbouiCOM.BoSearchKey.psk_Index);
            }

            mCmbAcct.Item.Enabled = true;

            IList <AccountDTO> ListAccounts = mBankDAO.GetBankAccounts(mCmbBank.Value.ToString());

            foreach (AccountDTO lObjAccount in ListAccounts)
            {
                mCmbAcct.ValidValues.Add(lObjAccount.Account, lObjAccount.Account);
            }
        }
    private void setMatrixItem(SAPbouiCOM.Matrix oMatrix, string Col, int Row, string val)
    {
        string sValue = "";

        try
        {
            if (oMatrix.Columns.Item(Col) == null)
            {
                trace("setMatrixItem Cannot found col: " + Col);
                return;
            }
            if (oMatrix.Columns.Item(Col).Cells.Item(Row) == null)
            {
                trace("setMatrixItem Cannot found col: " + Col + ", row: " + Row);
                return;
            }
            SAPbouiCOM.Cell cell = oMatrix.Columns.Item(Col).Cells.Item(Row);
            if (cell.Specific is SAPbouiCOM.EditText)
            {
                SAPbouiCOM.EditText oEt = (SAPbouiCOM.EditText)oMatrix.Columns.Item(Col).Cells.Item(Row).Specific;
                oEt.Value = val;
                return;
            }
            if (cell.Specific is SAPbouiCOM.StaticText)
            {
                SAPbouiCOM.StaticText oStatic = (SAPbouiCOM.StaticText)oMatrix.Columns.Item(Col).Cells.Item(Row).Specific;
                oStatic.Caption = val;
                return;
            }
            if (cell.Specific is SAPbouiCOM.ComboBox)
            {
                SAPbouiCOM.ComboBox oCB = (SAPbouiCOM.ComboBox)oMatrix.Columns.Item(Col).Cells.Item(Row).Specific;
                oCB.Select(val);
                return;
            }
        }
        catch (Exception ex)
        {
            errorLog("Can't find row:" + Row.ToString() + ",col:" + Col + "\r\n" + ex.Message);
        }
    }
    private void fillDateFieldsRecPay()
    {
        try
        {
            ed_fromDatePyR = ((SAPbouiCOM.EditText)(FormRecPay.Items.Item(txtFromdtPyR).Specific));
            FormRecPay.DataSources.UserDataSources.Add(txtFromdtPyR, SAPbouiCOM.BoDataType.dt_DATE, 20);
            ed_fromDatePyR.DataBind.SetBound(true, "", txtFromdtPyR);
            ed_fromDatePyR.Value = DatetimeTosapFormatDate(DateTime.Now);

            ed_ToDatePyR = ((SAPbouiCOM.EditText)(FormRecPay.Items.Item(txtTodtPyR).Specific));
            FormRecPay.DataSources.UserDataSources.Add(txtTodtPyR, SAPbouiCOM.BoDataType.dt_DATE, 20);
            ed_ToDatePyR.DataBind.SetBound(true, "", txtTodtPyR);
            ed_ToDatePyR.Value = DatetimeTosapFormatDate(DateTime.Now);

            Cmb_MenuPyR = ((SAPbouiCOM.ComboBox)(FormRecPay.Items.Item(cmbMenuStrPyR).Specific));
            Cmb_MenuPyR.Select(0, SAPbouiCOM.BoSearchKey.psk_Index);
        }
        catch (Exception ex)
        {
            errorLog(ex);
        }
    }
    private void reload(SAPbouiCOM.Form form, string customerID, ref List<SAPCust> list, ref SAPCust sel, bool bAll = false)
    {
        try
        {
           
            sel = new SAPCust();
            list = new List<SAPCust>();
            SAPbouiCOM.ComboBox oCB = form.Items.Item(cbPaymentMethod).Specific;
            try
            {
                while (oCB.ValidValues.Count > 0)
                    oCB.ValidValues.Remove(0, SAPbouiCOM.BoSearchKey.psk_Index);
            }
            catch (Exception)
            { }
            oCB.ValidValues.Add("New Card", "New Card");
            oCB.ValidValues.Add("New eCheck", "New eCheck");
            var q = from a in db.CCCUSTs
                    where a.CustomerID == customerID
                    select a;
            if (q.Count() == 0)
            {
                int n = oCB.ValidValues.Count - 2;
                SBO_Application.SetStatusBarMessage("Number of record in combo= " + n.ToString(), SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                
                oCB.Select("New Card");
                populateCustFromDB(form);
                SBO_Application.SetStatusBarMessage("Credit card for customer: " + getLabelCaption(form, stRecordID) + " loaded. No credit card record found", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                return;
            }
            if (q.Count() > 0)
            {
            
                bool hasDefault = false;
                foreach(CCCUST cust in q)
                {
                    if (cust.active == 'Y' || bAll)
                    {
                        SAPCust sapcust = new SAPCust();
                        sapcust.cccust = cust;
                        string id = cust.CustomerID + "_" + cust.recID.ToString();
                        sapcust.custObj = getCustomer(id);
                        if (sapcust.custObj.PaymentMethods.Count() == 0)
                        {
                            db.CCCUSTs.DeleteOnSubmit(cust);
                            db.SubmitChanges();
                        }
                        else
                        {
                            if(sapcust.custObj.PaymentMethods[0].MethodType == "check")
                                sapcust.key = cust.recID.ToString() + "_" + sapcust.custObj.PaymentMethods[0].Routing + " " + sapcust.custObj.PaymentMethods[0].Account + "(" + sapcust.custObj.BillingAddress.FirstName + " " + sapcust.custObj.BillingAddress.LastName + ")";
                            else
                                sapcust.key = cust.recID.ToString() + "_" + sapcust.custObj.PaymentMethods[0].CardNumber + " " + sapcust.custObj.PaymentMethods[0].CardExpiration + "(" + sapcust.custObj.BillingAddress.FirstName + " " + sapcust.custObj.BillingAddress.LastName + ")";
                            if (cust.Declined == 'Y')
                                sapcust.key = sapcust.key + ", Declined";
                            SAPbouiCOM.ValidValue v = oCB.ValidValues.Add(sapcust.key, sapcust.key);
                            list.Add(sapcust);
                            if (!hasDefault)
                                sel = sapcust;
                            if (cust.@default == 'Y')
                            {
                                hasDefault = true;
                                sel = sapcust;
                            }
                            

                        }
                    }
                }
            }
            if (sel.key != null)
                oCB.Select(sel.key);
            populateCCInfo(form, sel);
            SBO_Application.SetStatusBarMessage("Credit card for customer: " + getLabelCaption(form, stRecordID) + " loaded. " + oCB.ValidValues.Count + " credit card record(s) found", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
        }catch(Exception ex)
        {
             errorLog(ex);
        }
   
    }
Exemple #19
0
    private void CreateePaymentFormForm()
    {
        try
        {
            ManualScan = "0";
            SAPbouiCOM.Item   oItem   = null;
            SAPbouiCOM.Button oButton = null;
            //SAPbouiCOM.StaticText oStaticText = null;
            // SAPbouiCOM.EditText oEditText = null;
            //SAPbouiCOM.ComboBox oComboBox = null;

            // add a new form
            SAPbouiCOM.FormCreationParams oCreationParams = null;

            oCreationParams = ((SAPbouiCOM.FormCreationParams)(SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)));

            oCreationParams.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Fixed;
            oCreationParams.FormType    = formePaymentForm;

            oCreationParams.UniqueID = formePaymentForm;
            try
            {
                oePaymentFormForm = SBO_Application.Forms.AddEx(oCreationParams);
            }
            catch (Exception)
            {
                oePaymentFormForm = SBO_Application.Forms.Item(formePaymentForm);
            }

            // set the form properties
            oePaymentFormForm.Title        = "eBizCharge ePayment Form";
            oePaymentFormForm.Left         = 400;
            oePaymentFormForm.Top          = 100;
            oePaymentFormForm.ClientHeight = 460;
            oePaymentFormForm.ClientWidth  = 900;



            //************************
            // Adding a Rectangle
            //***********************
            int margin = 5;
            oItem        = oePaymentFormForm.Items.Add("Rect1", SAPbouiCOM.BoFormItemTypes.it_RECTANGLE);
            oItem.Left   = margin;
            oItem.Width  = oePaymentFormForm.ClientWidth - 2 * margin;
            oItem.Top    = margin;
            oItem.Height = oePaymentFormForm.ClientHeight - 40;

            int nTopGap = 25;
            int left    = 6;
            int wBtn    = 70;
            int hBtn    = 19;
            int span    = 80;


            oItem        = oePaymentFormForm.Items.Add(btnRefresh, SAPbouiCOM.BoFormItemTypes.it_BUTTON);
            oItem.Left   = left;
            oItem.Width  = wBtn;
            oItem.Top    = oePaymentFormForm.ClientHeight - nTopGap;
            oItem.Height = hBtn;

            oButton = ((SAPbouiCOM.Button)(oItem.Specific));

            oButton.Caption = "Refresh";
            left           += span;

            oItem        = oePaymentFormForm.Items.Add(btnAdd, SAPbouiCOM.BoFormItemTypes.it_BUTTON);
            oItem.Left   = left;
            oItem.Width  = wBtn;
            oItem.Top    = oePaymentFormForm.ClientHeight - nTopGap;
            oItem.Height = hBtn;

            oButton = ((SAPbouiCOM.Button)(oItem.Specific));

            oButton.Caption = "Send All";
            left           += span;

            /*
             * oItem = oePaymentFormForm.Items.Add(btnRun, SAPbouiCOM.BoFormItemTypes.it_BUTTON);
             * oItem.Left = left;
             * oItem.Width = wBtn;
             * oItem.Top = oePaymentFormForm.ClientHeight - nTopGap;
             * oItem.Height = hBtn;
             *
             * oButton = ((SAPbouiCOM.Button)(oItem.Specific));
             *
             * oButton.Caption = "Run";
             *
             * left += span;
             */
            oItem        = oePaymentFormForm.Items.Add(btnClose, SAPbouiCOM.BoFormItemTypes.it_BUTTON);
            oItem.Left   = left;
            oItem.Width  = wBtn;
            oItem.Top    = oePaymentFormForm.ClientHeight - nTopGap;
            oItem.Height = hBtn;

            oButton = ((SAPbouiCOM.Button)(oItem.Specific));

            oButton.Caption = "Cancel";

            margin = 8;
            int top  = 15;
            int edL  = 100; //oItm.Left + oItm.Width;
            int edW  = 100;
            int edH  = 15;
            int nGap = 26;

            oItem = addPaneItem(oePaymentFormForm, editCustomerID, edL, top, edW, edH, "Customer ID:", SAPbouiCOM.BoFormItemTypes.it_EDIT, 0, 1000, 80);
            oItem = addPaneItem(oePaymentFormForm, cbCustomerID, edL + 110, top, edW, edH, "", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX, 0, 1000);

            oItem        = oePaymentFormForm.Items.Add(btnFind, SAPbouiCOM.BoFormItemTypes.it_BUTTON);
            oItem.Left   = edL + 220;
            oItem.Width  = wBtn;
            oItem.Top    = top - 2;
            oItem.Height = hBtn;

            oButton = ((SAPbouiCOM.Button)(oItem.Specific));

            oButton.Caption = "Find";

            oItem = addPaneItem(oePaymentFormForm, cbGroup, edL + 400, top, edW, edH, "Customer Group", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX, 0, 1030);

            SAPbouiCOM.ComboBox oCB = (SAPbouiCOM.ComboBox)oItem.Specific;
            ComboAddItem(oCB, "");
            ComboAddItem(oCB, "All");
            List <string> list = GetGroupNames();
            foreach (string c in list)
            {
                ComboAddItem(oCB, c);
            }
            oItem = addPaneItem(oePaymentFormForm, cbEMTemplate, edL + 640, top, edW, edH, "Email Template", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX, 0, 1060);
            oCB   = (SAPbouiCOM.ComboBox)oItem.Specific;
            foreach (string s in ListEmailTemplate)
            {
                ComboAddItem(oCB, s);
            }
            string t = getDefaultEmailTemplate();
            if (t != "")
            {
                try
                {
                    oCB.Select(t);
                }catch (Exception)
                {
                    try
                    {
                        oCB.Select(0);
                    }
                    catch (Exception) { };
                }
            }
            else
            {
                try
                {
                    oCB.Select(0);
                }
                catch (Exception) { };
            }
            top = oItem.Top + nGap;


            oItem          = oePaymentFormForm.Items.Add(matrixePaymentForm, SAPbouiCOM.BoFormItemTypes.it_MATRIX);
            oItem.FromPane = 0;
            oItem.ToPane   = 0;
            oItem.Left     = 5 + margin;
            oItem.Width    = oePaymentFormForm.ClientWidth - 2 * margin - 10;
            oItem.Top      = top;
            oItem.Height   = oePaymentFormForm.ClientHeight - 100;
            top            = oItem.Height + oItem.Top + 2;
            SAPbouiCOM.Matrix oMatrix = (SAPbouiCOM.Matrix)oePaymentFormForm.Items.Item(matrixePaymentForm).Specific;
            oMatrix.SelectionMode = SAPbouiCOM.BoMatrixSelect.ms_Auto;
            SAPbouiCOM.Column oColumn = oMatrix.Columns.Add("DocNum", SAPbouiCOM.BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Invoice No.";
            oColumn.Width = 80;
            oColumn       = oMatrix.Columns.Add("Status", SAPbouiCOM.BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Status";
            oColumn.Width = 80;

            oColumn = oMatrix.Columns.Add("CustID", SAPbouiCOM.BoFormItemTypes.it_LINKED_BUTTON);
            oColumn.TitleObject.Caption = "Customer";
            oColumn.Width = 80;
            SAPbouiCOM.LinkedButton btn = (SAPbouiCOM.LinkedButton)oColumn.ExtendedObject;
            btn.LinkedObjectType = ((int)SAPbouiCOM.BoLinkedObject.lf_BusinessPartner).ToString();

            oColumn = oMatrix.Columns.Add("CName", SAPbouiCOM.BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Customer Name";
            oColumn.Width = 80;
            oColumn       = oMatrix.Columns.Add("E_Mail", SAPbouiCOM.BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "EMail";
            oColumn.Width = 80;

            oColumn = oMatrix.Columns.Add("InvID", SAPbouiCOM.BoFormItemTypes.it_LINKED_BUTTON);
            oColumn.TitleObject.Caption = "Origin No.";
            btn = (SAPbouiCOM.LinkedButton)oColumn.ExtendedObject;
            btn.LinkedObjectType = ((int)SAPbouiCOM.BoLinkedObject.lf_Invoice).ToString();
            oColumn.Width        = 80;



            oColumn = oMatrix.Columns.Add("UploadDT", SAPbouiCOM.BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Sent Date";
            oColumn.Width = 80;

            oColumn = oMatrix.Columns.Add("PaidDT", SAPbouiCOM.BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Payment Date";
            oColumn.Width = 80;

            oColumn = oMatrix.Columns.Add("Balance", SAPbouiCOM.BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Balance";
            oColumn.Width = 80;
            oColumn       = oMatrix.Columns.Add("UpBal", SAPbouiCOM.BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Balance Sented";
            oColumn.Width = 80;
            oColumn       = oMatrix.Columns.Add("AmtPaid", SAPbouiCOM.BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Last ePayment";
            oColumn.Width = 80;
            // populateePaymentFormMatrix();
            oMatrix.SelectionMode = SAPbouiCOM.BoMatrixSelect.ms_Single;
        }
        catch (Exception ex)
        {
            errorLog(ex);
        }
        oePaymentFormForm.Visible = true;
    }
Exemple #20
0
    private void AddCCPMFormField(SAPbouiCOM.Form form, int pane)
    {
        try
        {
            int             edL  = 110 + 15; //oItm.Left + oItm.Width;
            int             edW  = 250;
            int             edT  = 54;
            int             edH  = 15;
            int             nGap = 17;
            SAPbouiCOM.Item oItm = null;
            switch (theActiveForm.TypeEx)
            {
            case "139":     //Sales Order
                oItm = addPaneItem(form, stRecordID, edL, edT, edW, edH, "Sales Order ID", SAPbouiCOM.BoFormItemTypes.it_STATIC, pane, 0);
                break;

            case "133":     //Invoice
                oItm = addPaneItem(form, stRecordID, edL, edT, edW, edH, "Invoice ID", SAPbouiCOM.BoFormItemTypes.it_STATIC, pane, 0);
                break;

            case "179":     //Credit Memo
                oItm = addPaneItem(form, stRecordID, edL, edT, edW, edH, "Credit Memo ID", SAPbouiCOM.BoFormItemTypes.it_STATIC, pane, 0);
                break;

            case "170":
                //FORMTYPE.INCOMING_PAYMENT;
                oItm = addPaneItem(form, stRecordID, edL, edT, edW, edH, "Incoming Payment", SAPbouiCOM.BoFormItemTypes.it_STATIC, pane, 0);
                break;

            case "420":     //FORMTYPE.OUTGOING_PAYMENT;
                oItm = addPaneItem(form, stRecordID, edL, edT, edW, edH, "Outgoing Payment", SAPbouiCOM.BoFormItemTypes.it_STATIC, pane, 0);
                break;

            case "60091":      //A/R Reserve Invoice
                oItm = addPaneItem(form, stRecordID, edL, edT, edW, edH, "Invoice ID:", SAPbouiCOM.BoFormItemTypes.it_STATIC, pane, 0);
                break;

            case "65300":     //Down Payment Invoice
                oItm = addPaneItem(form, stRecordID, edL, edT, edW, edH, "Invoice ID:", SAPbouiCOM.BoFormItemTypes.it_STATIC, pane, 0);
                break;

            default:
                oItm = addPaneItem(form, stRecordID, edL, edT, edW, edH, "Record ID:", SAPbouiCOM.BoFormItemTypes.it_STATIC, pane, 0);
                break;
            }

            edT  = oItm.Top + nGap;
            oItm = addPaneItem(form, cbPaymentMethod, edL, edT, edW, edH, "Payment Method:", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX, pane, 1);
            edT  = oItm.Top + nGap;
            oItm = addPaneItem(form, editCardNum, edL, edT, edW, edH, "Card Number:", SAPbouiCOM.BoFormItemTypes.it_EDIT, pane, 2);
            edT  = oItm.Top + nGap;
            oItm = addPaneItem(form, editCardExpDate, edL, edT, edW, edH, "Card Exp. Date:", SAPbouiCOM.BoFormItemTypes.it_EDIT, pane, 3);
            edT  = oItm.Top + nGap;
            oItm = addPaneItem(form, editCardCode, edL, edT, edW, edH, "Card Code:", SAPbouiCOM.BoFormItemTypes.it_EDIT, pane, 4);
            edT  = oItm.Top + nGap;
            oItm = addPaneItem(form, editHolderName, edL, edT, edW, edH, "Card Holder:", SAPbouiCOM.BoFormItemTypes.it_EDIT, pane, 6);
            edT  = oItm.Top + nGap;
            oItm = addPaneItem(form, editHolderAddr, edL, edT, edW, edH, "Address:", SAPbouiCOM.BoFormItemTypes.it_EDIT, pane, 7);
            edT  = oItm.Top + nGap;
            oItm = addPaneItem(form, editHolderCity, edL, edT, edW, edH, "City:", SAPbouiCOM.BoFormItemTypes.it_EDIT, pane, 8);
            edT  = oItm.Top + nGap;
            oItm = addPaneItem(form, editHolderState, edL, edT, edW, edH, "State:", SAPbouiCOM.BoFormItemTypes.it_EDIT, pane, 9);
            edT  = oItm.Top + nGap;
            oItm = addPaneItem(form, editHolderZip, edL, edT, edW, edH, "Zip:", SAPbouiCOM.BoFormItemTypes.it_EDIT, pane, 10);
            edT  = oItm.Top + 2 * nGap;

            oItm = addPaneItem(form, editCAmount, edL, edT, 100, edH, "Amount:", SAPbouiCOM.BoFormItemTypes.it_EDIT, pane, 11);
            edT  = oItm.Top + nGap;
            oItm = addPaneItem(form, cbTransactionType, edL, edT, 100, edH, "Transaction Type:", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX, pane, 12);
            SAPbouiCOM.ComboBox oCB = form.Items.Item(cbTransactionType).Specific;
            switch (theActiveForm.TypeEx)
            {
            case "139":     //Sales Order
                oCB.ValidValues.Add("Pre-auth", "Pre-auth");
                oCB.ValidValues.Add("Charge", "Charge");
                oCB.Select("Pre-auth");
                setLabelCaption(form, stRecordID, getItemValue(theActiveForm, fidRecordID));
                break;

            case "133":     //Invoice

                oCB.ValidValues.Add("Charge", "Charge");
                oCB.Select("Charge");
                if (CheckCapture(form))
                {
                    oCB.ValidValues.Add("Capture", "Capture");
                    oCB.Select("Capture");
                }
                setLabelCaption(form, stRecordID, getItemValue(theActiveForm, fidRecordID));
                break;

            case "179":     //Credit Memo
                oCB.ValidValues.Add("Credit", "Credit");
                oCB.Select("Credit");
                setLabelCaption(form, stRecordID, getItemValue(theActiveForm, fidRecordID));
                break;

            case "170":
                //FORMTYPE.INCOMING_PAYMENT;
                oCB.ValidValues.Add("Charge", "Charge");
                oCB.Select("Charge");
                break;

            case "420":     //FORMTYPE.OUTGOING_PAYMENT;
                oCB.ValidValues.Add("Credit", "Credit");
                oCB.Select("Credit");
                break;

            case "60091":      //A/R Reserve Invoice
                oCB.ValidValues.Add("Charge", "Charge");
                oCB.Select("Charge");
                setLabelCaption(form, stRecordID, getItemValue(theActiveForm, fidRecordID));
                break;

            case "65300":     //Down Payment Invoice
                oCB.ValidValues.Add("Charge", "Charge");
                oCB.Select("Charge");
                setLabelCaption(form, stRecordID, getItemValue(theActiveForm, fidRecordID));
                break;
            }
            setFormEditVal(form, editCAmount, getItemValue(form, "14"));
        }
        catch (Exception ex)
        {
            errorLog(ex);
        }
    }
Exemple #21
0
        private void DoPayment()
        {
            try
            {
                if (ValidateEmptyControls())
                {
                    Application.SBO_Application.SetStatusBarMessage("Verificar campos vacíos", SAPbouiCOM.BoMessageTime.bmt_Short, true);
                    return;
                }

                if (dtTravelExp.Rows.Count <= 0)
                {
                    Application.SBO_Application.SetStatusBarMessage("No puede crear un pago sin líneas", SAPbouiCOM.BoMessageTime.bmt_Short, true);
                    return;
                }

                if (string.IsNullOrEmpty(mStrExpDayAcct) || string.IsNullOrEmpty(mStrMinorPurchAcct) || string.IsNullOrEmpty(mStrViaticExpAcct) || string.IsNullOrEmpty(mStrViaticPaymAcct))
                {
                    Application.SBO_Application.SetStatusBarMessage("Alguna de las cuentas de configuración no tiene valor, favor de verificar", SAPbouiCOM.BoMessageTime.bmt_Short, true);
                    return;
                }

                this.UIAPIRawForm.Freeze(true);

                Application.SBO_Application.ActivateMenuItem("2818");

                if (!Application.SBO_Application.Menus.Item("6913").Checked)
                {
                    Application.SBO_Application.ActivateMenuItem("6913");//2050
                }

                SAPbouiCOM.EditText txtDocDate = ((SAPbouiCOM.EditText)UIApplication.GetApplication().Forms.GetForm("426", -1).Items.Item("10").Specific);
                txtDocDate.Value = DateTime.Now.ToString("yyyyMMdd");

                SAPbouiCOM.OptionBtn optionBtnAccount = ((SAPbouiCOM.OptionBtn)UIApplication.GetApplication().Forms.GetForm("426", -1).Items.Item("58").Specific);
                optionBtnAccount.Selected = true;

                SAPbouiCOM.ComboBox cboPymtType = ((SAPbouiCOM.ComboBox)UIApplication.GetApplication().Forms.GetForm("-426", -1).Items.Item("U_GLO_PaymentType").Specific);
                cboPymtType.Select(PaymentsTypesEnum.TravelExpenses.Value, SAPbouiCOM.BoSearchKey.psk_ByValue);

                SAPbouiCOM.EditText txtCodeMov = ((SAPbouiCOM.EditText)UIApplication.GetApplication().Forms.GetForm("-426", -1).Items.Item("U_GLO_CodeMov").Specific);
                txtCodeMov.Value = txtFolio.Value;

                //SAPbouiCOM.EditText txtCostCenter = ((SAPbouiCOM.EditText)UIApplication.GetApplication().Forms.GetForm("-426", -1).Items.Item("U_GLO_CostCenter").Specific);
                //txtCostCenter.Value = "MQ_MAQUI";

                SAPbouiCOM.ComboBox cboCostCenter = ((SAPbouiCOM.ComboBox)UIApplication.GetApplication().Forms.GetForm("-426", -1).Items.Item("U_GLO_CostCenter").Specific);
                cboCostCenter.Select("MQ_MAQUI", SAPbouiCOM.BoSearchKey.psk_ByValue);

                SAPbouiCOM.ComboBox cboAuxiliarType = ((SAPbouiCOM.ComboBox)UIApplication.GetApplication().Forms.GetForm("-426", -1).Items.Item("U_FZ_AuxiliarType").Specific);
                cboAuxiliarType.Select(((int)AuxiliaryTypeEnum.Employees).ToString(), SAPbouiCOM.BoSearchKey.psk_ByValue);

                SAPbouiCOM.EditText txtAuxiliar = ((SAPbouiCOM.EditText)UIApplication.GetApplication().Forms.GetForm("-426", -1).Items.Item("U_FZ_Auxiliar").Specific);
                txtAuxiliar.Value = mStrSupervisorCode;

                SAPbouiCOM.EditText txtFolioOri = ((SAPbouiCOM.EditText)UIApplication.GetApplication().Forms.GetForm("-426", -1).Items.Item("U_GLO_FolioOri").Specific);
                txtFolioOri.Value = txtRiseFolio.Value;

                SAPbouiCOM.EditText txtObjType = ((SAPbouiCOM.EditText)UIApplication.GetApplication().Forms.GetForm("-426", -1).Items.Item("U_GLO_ObjType").Specific);
                txtObjType.Value = this.UIAPIRawForm.UniqueID;

                SAPbouiCOM.Button btnBank = ((SAPbouiCOM.Button)UIApplication.GetApplication().Forms.GetForm("426", -1).Items.Item("234000001").Specific);
                btnBank.Item.Click();

                SAPbouiCOM.Folder folderCash = ((SAPbouiCOM.Folder)UIApplication.GetApplication().Forms.GetForm("196", -1).Items.Item("6").Specific);
                folderCash.Item.Click();

                SAPbouiCOM.EditText txtAccount = ((SAPbouiCOM.EditText)UIApplication.GetApplication().Forms.GetForm("196", -1).Items.Item("32").Specific);
                txtAccount.Value = mStrViaticPaymAcct;

                SAPbouiCOM.EditText txtImport = ((SAPbouiCOM.EditText)UIApplication.GetApplication().Forms.GetForm("196", -1).Items.Item("38").Specific);
                txtImport.Value = txtTotal.Value;

                SAPbouiCOM.Button btnOk = ((SAPbouiCOM.Button)UIApplication.GetApplication().Forms.GetForm("196", -1).Items.Item("1").Specific);
                btnOk.Item.Click();

                SAPbouiCOM.Matrix mtxPayment = ((SAPbouiCOM.Matrix)UIApplication.GetApplication().Forms.GetForm("426", -1).Items.Item("71").Specific);
                for (int i = 0; i < dtTravelExp.Rows.Count; i++)
                {
                    mtxPayment.AddRow();

                    string lStrMovTypeCode  = dtTravelExp.GetValue(9, i).ToString();
                    double lDblLineImport   = double.Parse(dtTravelExp.GetValue(8, i).ToString());
                    string lStrEmployeeType = dtTravelExp.GetValue(10, i).ToString();
                    string lStrEmployeeCode = dtTravelExp.GetValue(5, i).ToString();
                    double lDblDayPrice     = double.Parse(dtTravelExp.GetValue(7, i).ToString());

                    if (lDblDayPrice > 0)
                    {
                        ((SAPbouiCOM.EditText)mtxPayment.Columns.Item("5").Cells.Item(i + 1).Specific).Value = lDblLineImport.ToString();
                        ((SAPbouiCOM.ComboBox)mtxPayment.Columns.Item("U_GLO_TypeViatic").Cells.Item(i + 1).Specific).Select(lStrMovTypeCode.ToString(), SAPbouiCOM.BoSearchKey.psk_ByDescription);
                        ((SAPbouiCOM.ComboBox)mtxPayment.Columns.Item("U_MQ_TypeEmp").Cells.Item(i + 1).Specific).Select(lStrEmployeeType, SAPbouiCOM.BoSearchKey.psk_ByValue);
                        ((SAPbouiCOM.EditText)mtxPayment.Columns.Item("U_MQ_Aux").Cells.Item(i + 1).Specific).Value      = lStrEmployeeCode;
                        ((SAPbouiCOM.EditText)mtxPayment.Columns.Item("U_MQ_DayPrice").Cells.Item(i + 1).Specific).Value = lDblDayPrice.ToString();

                        TravelExpMovTypesEnum lTravExpTypeEnum = TravelExpMovTypesEnum.GetEnum(lStrMovTypeCode);
                        if (TravelExpMovTypesEnum.IsTravelExpensesType(lTravExpTypeEnum))
                        {
                            ((SAPbouiCOM.EditText)mtxPayment.Columns.Item("8").Cells.Item(i + 1).Specific).Value = mStrViaticExpAcct; //cuenta de mayor
                        }
                        else if (TravelExpMovTypesEnum.IsDayExpensesType(lTravExpTypeEnum))
                        {
                            ((SAPbouiCOM.EditText)mtxPayment.Columns.Item("8").Cells.Item(i + 1).Specific).Value = mStrExpDayAcct; //cuenta de mayor
                        }
                        else if (TravelExpMovTypesEnum.IsMinorExpensesType(lTravExpTypeEnum))
                        {
                            ((SAPbouiCOM.EditText)mtxPayment.Columns.Item("8").Cells.Item(i + 1).Specific).Value = mStrMinorPurchAcct; //cuenta de mayor
                        }
                    }
                }

                this.UIAPIRawForm.Close();

                #region Payment

                /*SAPbobsCOM.Payments lObjOutgoingPayment = (SAPbobsCOM.Payments)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPaymentsDrafts);
                 * lObjOutgoingPayment.DocObjectCode = SAPbobsCOM.BoPaymentsObjectType.bopot_OutgoingPayments;
                 * lObjOutgoingPayment.DocDate = DateTime.Now;
                 * lObjOutgoingPayment.DocType = SAPbobsCOM.BoRcptTypes.rAccount;
                 * lObjOutgoingPayment.CashAccount = mStrViaticPaymAcct;
                 * lObjOutgoingPayment.UserFields.Fields.Item("U_GLO_PaymentType").Value = PaymentsTypesEnum.TravelExpenses.Value;
                 * lObjOutgoingPayment.UserFields.Fields.Item("U_GLO_CodeMov").Value = txtFolio.Value; //folio de solicitud de viáticos
                 * lObjOutgoingPayment.UserFields.Fields.Item("U_GLO_CostCenter").Value = "MQ_MAQUI"; //centro de costo
                 * lObjOutgoingPayment.UserFields.Fields.Item("U_FZ_AuxiliarType").Value = ((int)AuxiliaryTypeEnum.Employees).ToString(); //tipo de auxiliar
                 * lObjOutgoingPayment.UserFields.Fields.Item("U_FZ_Auxiliar").Value = mStrSupervisorCode; //auxiliar
                 * lObjOutgoingPayment.UserFields.Fields.Item("U_GLO_FolioOri").Value = txtRiseFolio.Value;
                 * lObjOutgoingPayment.UserFields.Fields.Item("U_GLO_ObjType").Value = this.UIAPIRawForm.UniqueID;
                 * lObjOutgoingPayment.CashSum = double.Parse(txtTotal.Value);
                 *
                 * for (int i = 0; i < dtTravelExp.Rows.Count; i++)
                 * {
                 *  string lStrMovTypeCode = dtTravelExp.GetValue(9, i).ToString();
                 *  double lDblLineImport = double.Parse(dtTravelExp.GetValue(8, i).ToString());
                 *  string lStrEmployeeType = dtTravelExp.GetValue(10, i).ToString();
                 *  string lStrEmployeeCode = dtTravelExp.GetValue(5, i).ToString();
                 *  double lDblDayPrice = double.Parse(dtTravelExp.GetValue(7, i).ToString());
                 *
                 *  if (lDblDayPrice > 0)
                 *  {
                 *      lObjOutgoingPayment.AccountPayments.SetCurrentLine(i);
                 *      lObjOutgoingPayment.AccountPayments.SumPaid = lDblLineImport;
                 *      lObjOutgoingPayment.AccountPayments.UserFields.Fields.Item("U_GLO_TypeViatic").Value = lStrMovTypeCode.ToString();
                 *      lObjOutgoingPayment.AccountPayments.UserFields.Fields.Item("U_MQ_TypeEmp").Value = lStrEmployeeType;
                 *      lObjOutgoingPayment.AccountPayments.UserFields.Fields.Item("U_MQ_Aux").Value = lStrEmployeeCode; //code empleado
                 *      lObjOutgoingPayment.AccountPayments.UserFields.Fields.Item("U_MQ_DayPrice").Value = lDblDayPrice;
                 *
                 *      TravelExpMovTypesEnum lTravExpTypeEnum = TravelExpMovTypesEnum.GetEnum(lStrMovTypeCode);
                 *      if (TravelExpMovTypesEnum.IsTravelExpensesType(lTravExpTypeEnum))
                 *      {
                 *          lObjOutgoingPayment.AccountPayments.AccountCode = mStrViaticExpAcct;
                 *      }
                 *      else if (TravelExpMovTypesEnum.IsDayExpensesType(lTravExpTypeEnum))
                 *      {
                 *          lObjOutgoingPayment.AccountPayments.AccountCode = mStrExpDayAcct;
                 *      }
                 *      else if (TravelExpMovTypesEnum.IsMinorExpensesType(lTravExpTypeEnum))
                 *      {
                 *          lObjOutgoingPayment.AccountPayments.AccountCode = mStrMinorPurchAcct;
                 *      }
                 *
                 *      lObjOutgoingPayment.AccountPayments.Add();
                 *  }
                 * }
                 *
                 * if (lObjOutgoingPayment.Add() != 0)
                 * {
                 *  string lStrLastError = DIApplication.Company.GetLastErrorDescription();
                 *  UIApplication.ShowMessageBox(string.Format("Error al generar el pago: {0}", DIApplication.Company.GetLastErrorDescription()));
                 * }
                 * else
                 * {
                 *  int lIntDocEntry = int.Parse(DIApplication.Company.GetNewObjectKey());
                 *
                 *  mObjTravelExpensesDTO = mObjMachinerySeviceFactory.GetTravelExpensesService().GetDraftPayment(lIntDocEntry);
                 *
                 *  UIApplication.GetApplication().OpenForm((SAPbouiCOM.BoFormObjectEnum)140, "", lIntDocEntry.ToString());
                 *
                 *  this.UIAPIRawForm.Close();
                 * }*/
                #endregion
            }
            catch (Exception lObjException)
            {
                LogUtility.WriteError(string.Format("[frmTravelExpenses - DoPayment] Error al realizar el pago efectuado: {0}", lObjException.Message));
                Application.SBO_Application.MessageBox(string.Format("Error al realizar el pago efectuado: {0}", lObjException.Message));
            }
            finally
            {
                this.UIAPIRawForm.Freeze(false);
            }
        }
Exemple #22
0
    private void OrderImpFormHandler(SAPbouiCOM.Form form, SAPbouiCOM.ItemEvent pVal)
    {
        try
        {
            oOrderImpForm = form;
            if (pVal.BeforeAction)
            {
            }
            else
            {
                switch (pVal.EventType)
                {
                case SAPbouiCOM.BoEventTypes.et_CLICK:

                    break;

                case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED:
                {
                    switch (pVal.ItemUID)
                    {
                    case btnClose:
                        oOrderImpForm.Close();
                        break;

                    case btnImp:
                        try
                        {
                            if (transObjForImport == null)
                            {
                                form.Items.Item(btnFind).Click();
                            }
                            else
                            {
                                string cardcode = getFormItemVal(form, cbCustomerID);
                                if (cardcode == "")
                                {
                                    showMessage("Please select a customer.");
                                }
                                else
                                {
                                    if (transObjForImport == null)
                                    {
                                        form.Items.Item(btnFind).Click();
                                    }
                                    else
                                    {
                                        if (SBO_Application.MessageBox("Import order to " + cardcode + "?", 1, "Yes", "No") == 1)
                                        {
                                            SBO_Application.Menus.Item(MENU_SO).Activate();
                                            SAPbobsCOM.Documents doc = importSalesOrder();

                                            SBO_Application.Menus.Item(MENU_LAST).Activate();
                                            SBO_Application.SetStatusBarMessage(string.Format("Import order {0} added to {1}.", doc.DocNum, cardcode), SAPbouiCOM.BoMessageTime.bmt_Medium, true);
                                        }
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            SBO_Application.SetStatusBarMessage(string.Format("Import order error: {0}.", ex.Message), SAPbouiCOM.BoMessageTime.bmt_Medium, true);
                        }
                        break;

                    case btnFind:
                        try
                        {
                            string transID = getFormItemVal(form, editTransID);
                            if (transID == "")
                            {
                                showMessage("Please enter transaction ID.");
                            }
                            else
                            {
                                SBO_Application.SetStatusBarMessage("Finding transaction please wait...", SAPbouiCOM.BoMessageTime.bmt_Medium, false);

                                SecurityToken token = getToken("");
                                //transObjForImport = ebiz.getTransaction(token, transID);
                                setLabelCaption(form, lbCardHolder, transObjForImport.BillingAddress.FirstName + " " + transObjForImport.BillingAddress.LastName);
                                setLabelCaption(form, lbTAmount, transObjForImport.Details.Amount.ToString());
                                setLabelCaption(form, lbCustID, transObjForImport.CustomerID);
                                setLabelCaption(form, lbTax, transObjForImport.Details.Tax.ToString());
                                setLabelCaption(form, lbShipping, transObjForImport.Details.Shipping.ToString());
                                setLabelCaption(form, lbDiscount, transObjForImport.Details.Discount.ToString());

                                SAPbouiCOM.ComboBox oCB = (SAPbouiCOM.ComboBox)form.Items.Item(cbOrderItem).Specific;
                                try
                                {
                                    while (oCB.ValidValues.Count > 0)
                                    {
                                        oCB.ValidValues.Remove(0, SAPbouiCOM.BoSearchKey.psk_Index);
                                    }
                                }
                                catch (Exception)
                                { }
                                ComboAddItem(oCB, "");
                                string s = "";
                                int    i = 0;
                                foreach (LineItem item in transObjForImport.LineItems)
                                {
                                    i++;
                                    if (item.SKU == null || item.SKU == "")
                                    {
                                        item.SKU = "SKU-" + i.ToString();
                                    }
                                    s = string.Format("{0} - {1} {2}x{3}", item.SKU, item.ProductName, item.Qty, item.UnitPrice);

                                    ComboAddItem(oCB, s);
                                }
                                try
                                {
                                    oCB.Select(s);
                                }
                                catch (Exception) { }
                                SBO_Application.SetStatusBarMessage(string.Format("{0} Order Item(s) ready to import.", oCB.ValidValues.Count - 1), SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                                // form.Items.Item(btnImp).Click();
                            }
                        }
                        catch (Exception ex)
                        {
                            transObjForImport = null;
                            SAPbouiCOM.ComboBox oCB = (SAPbouiCOM.ComboBox)form.Items.Item(cbOrderItem).Specific;
                            try
                            {
                                while (oCB.ValidValues.Count > 0)
                                {
                                    oCB.ValidValues.Remove(0, SAPbouiCOM.BoSearchKey.psk_Index);
                                }
                            }
                            catch (Exception)
                            { }
                            ComboAddItem(oCB, "");
                            oCB.Select("");
                            SBO_Application.SetStatusBarMessage(string.Format("Find transaction error: {0}.", ex.Message), SAPbouiCOM.BoMessageTime.bmt_Medium, true);

                            errorLog(ex);
                        }
                        break;
                    }
                }
                break;
                }
            }
        }
        catch (Exception ex)
        {
            errorLog(ex);
        }
    }
Exemple #23
0
        public static void Agregar_Items_Desde_Solicitud_Interna(int nDocOrd, int nOrden, string sSerie)
        {
            Recordset businessObject = (Recordset)oCompany.GetBusinessObject(BoObjectTypes.BoRecordset);
            Items     oItems         = (SAPbobsCOM.Items)oCompany.GetBusinessObject(BoObjectTypes.oItems);

            SAPbouiCOM.Matrix   oMatrix   = null;
            SAPbouiCOM.ComboBox oComboBox = null;

            string itemCode = "";

            try
            {
                oForm.Freeze(true);

                SAPbouiCOM.DBDataSource source = oForm.DataSources.DBDataSources.Item("IGE1");

                Documents oPurchaseRequest = (Documents)oCompany.GetBusinessObject(BoObjectTypes.oPurchaseRequest);
                double    nCantArt         = 0;
                int       iSal             = 0;

                if (oPurchaseRequest.GetByKey(nDocOrd))
                {
                    oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("13").Specific;
                    for (int i = 0; i < oPurchaseRequest.Lines.Count; i++)
                    {
                        oPurchaseRequest.Lines.SetCurrentLine(i);
                        itemCode = oPurchaseRequest.Lines.ItemCode;
                        if (oItems.GetByKey(itemCode) && oPurchaseRequest.Lines.RemainingOpenQuantity > 0)
                        {
                            oEdit        = (SAPbouiCOM.EditText)oMatrix.Columns.Item("1").Cells.Item(iSal + 1).Specific;
                            oEdit.String = oPurchaseRequest.Lines.ItemCode;

                            oEdit        = (SAPbouiCOM.EditText)oMatrix.Columns.Item("9").Cells.Item(iSal + 1).Specific;
                            oEdit.String = Convert.ToString(oPurchaseRequest.Lines.RemainingOpenQuantity);

                            oEdit              = (SAPbouiCOM.EditText)oMatrix.Columns.Item("231000074").Cells.Item(iSal + 1).Specific;
                            oEdit.Active       = true;
                            oEdit.Item.Enabled = true;
                            oEdit.String       = Convert.ToString(nOrden);

                            oEdit              = (SAPbouiCOM.EditText)oMatrix.Columns.Item("24").Cells.Item(iSal + 1).Specific;
                            oEdit.Active       = true;
                            oEdit.Item.Enabled = true;
                            oEdit.String       = Convert.ToString(oPurchaseRequest.Lines.LineNum);

                            nCantArt += oPurchaseRequest.Lines.Quantity;
                            iSal     += 1;
                        }
                    }


                    //Agregar como Referencia Numero de SCI
                    oEdit        = (SAPbouiCOM.EditText)oForm.Items.Item("Item_0").Specific;
                    oEdit.String = sSerie.Trim() + "-" + Convert.ToString(nOrden);
                    oComboBox    = (SAPbouiCOM.ComboBox)oForm.Items.Item("30").Specific;
                    oComboBox.Select("SI", SAPbouiCOM.BoSearchKey.psk_ByDescription);

                    SAPbouiCOM.UserDataSource oUds = oForm.DataSources.UserDataSources.Item("UD_SCI");
                    oUds.ValueEx = nDocOrd.ToString();
                    oUds         = oForm.DataSources.UserDataSources.Item("UD_CANT");
                    oUds.ValueEx = nCantArt.ToString();

                    oPurchaseRequest.Lines.SetCurrentLine(iSal - 1);
                    itemCode           = oPurchaseRequest.Lines.ItemCode;
                    oEdit              = (SAPbouiCOM.EditText)oMatrix.Columns.Item("U_FAS_Kilos_Unitario").Cells.Item(iSal).Specific;
                    oEdit.Active       = true;
                    oEdit.Item.Enabled = true;
                    oEdit.Item.Click();

                    System.Runtime.InteropServices.Marshal.ReleaseComObject(oPurchaseRequest);
                    oPurchaseRequest = null;
                    GC.Collect();
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                oForm.Freeze(false);
                Application.SBO_Application.SendKeys("{TAB}");
            }
        }
        private void CreateMySimpleForm()
        {
            SAPbouiCOM.Item       oItem       = null;
            SAPbouiCOM.Button     oButton     = null;
            SAPbouiCOM.StaticText oStaticText = null;
            SAPbouiCOM.EditText   oEditText   = null;
            SAPbouiCOM.ComboBox   oComboBox   = null;


            //adicionar novo form
            SAPbouiCOM.FormCreationParams oCreationParams = null;
            oCreationParams             = ((SAPbouiCOM.FormCreationParams)(oApplication.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)));
            oCreationParams.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Fixed;
            oCreationParams.UniqueID    = "MeuFormSimples";

            oForm = oApplication.Forms.AddEx(oCreationParams);
            oForm.DataSources.UserDataSources.Add("EditSource", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 20);
            oForm.DataSources.UserDataSources.Add("CombSource", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 20);

            //setar as propriedades do form
            oForm.Title        = "Formulário Simples Herbert";
            oForm.Left         = 400;
            oForm.Top          = 100;
            oForm.ClientHeight = 80;
            oForm.ClientWidth  = 350;

            // add o botão ok
            oItem           = oForm.Items.Add("1", SAPbouiCOM.BoFormItemTypes.it_BUTTON);
            oItem.Left      = 0;
            oItem.Width     = 65;
            oItem.Top       = 52;
            oItem.Height    = 19;
            oButton         = ((SAPbouiCOM.Button)(oItem.Specific));
            oButton.Caption = "OK";

            // add botão cancelar
            oItem           = oForm.Items.Add("2", SAPbouiCOM.BoFormItemTypes.it_BUTTON);
            oItem.Left      = 70;
            oItem.Width     = 65;
            oItem.Top       = 52;
            oItem.Height    = 19;
            oButton         = ((SAPbouiCOM.Button)(oItem.Specific));
            oButton.Caption = "Cancel";

            //adicionar retangulo
            oItem        = oForm.Items.Add("Rect1", SAPbouiCOM.BoFormItemTypes.it_RECTANGLE);
            oItem.Left   = 0;
            oItem.Width  = 344;
            oItem.Top    = 1;
            oItem.Height = 49;

            // adicionar label
            oItem               = oForm.Items.Add("SaticTxt1", SAPbouiCOM.BoFormItemTypes.it_STATIC);
            oItem.Left          = 7;
            oItem.Width         = 148;
            oItem.Top           = 8;
            oItem.Height        = 14;
            oItem.LinkTo        = "EditText1";
            oStaticText         = ((SAPbouiCOM.StaticText)(oItem.Specific));
            oStaticText.Caption = "Static Text 1";

            //adicionar outro label
            oItem               = oForm.Items.Add("StaticTxt2", SAPbouiCOM.BoFormItemTypes.it_STATIC);
            oItem.Left          = 7;
            oItem.Width         = 148;
            oItem.Top           = 24;
            oItem.Height        = 14;
            oItem.LinkTo        = "ComboBox1";
            oStaticText         = ((SAPbouiCOM.StaticText)(oItem.Specific));
            oStaticText.Caption = "Static Text 1";

            //adicionar Edit Text
            oItem        = oForm.Items.Add("EditText1", SAPbouiCOM.BoFormItemTypes.it_EDIT);
            oItem.Left   = 157;
            oItem.Width  = 163;
            oItem.Top    = 8;
            oItem.Height = 14;
            oEditText    = ((SAPbouiCOM.EditText)(oItem.Specific));
            oEditText.DataBind.SetBound(true, "", "EditSource");
            oEditText.String = "Edit Text 1";

            //adicionar Combo Box
            oItem        = oForm.Items.Add("ComboBox1", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX);
            oItem.Left   = 157;
            oItem.Width  = 163;
            oItem.Top    = 24;
            oItem.Height = 14;

            oItem.DisplayDesc = true;

            oComboBox = ((SAPbouiCOM.ComboBox)(oItem.Specific));

            oComboBox.DataBind.SetBound(true, "", "CombSource");


            oComboBox.ValidValues.Add("0", "Selecione");
            oComboBox.ValidValues.Add("1", "Combo Value 1");
            oComboBox.ValidValues.Add("2", "Combo Value 2");
            oComboBox.ValidValues.Add("3", "Combo Value 3");
            oComboBox.Select("0", SAPbouiCOM.BoSearchKey.psk_ByValue);
        }
Exemple #25
0
    /*
     *  if(freq != F_Onetime && oDoc.GetByKey(int.Parse(INVDocEntry)))
                        {

                        }
     */
    private void AddJobFormField(SAPbouiCOM.Form form)
    {
        try
        {
            int edL = 140; //oItm.Left + oItm.Width;
            int edW = 250;
            int edT = 20;
            int edH = 15;
            int nGap = 20;

            SAPbouiCOM.Item oItm = null;
            if (SODocEntry == "")
            {
                oItm = addPaneItem(form, editCustomerID, edL, edT, edW, edH, "Customer ID:", SAPbouiCOM.BoFormItemTypes.it_EDIT, 0, 1100, 100);
                edT = oItm.Top + nGap;
                oItm = addPaneItem(form, cbPaymentMethod, edL, edT, edW, edH, "Payment Method:", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX, 0, 1101, 100);
                edT = oItm.Top + nGap;
                oItm = addPaneItem(form, editInvNo, edL, edT, edW, edH, "Invoice #:", SAPbouiCOM.BoFormItemTypes.it_EDIT, 0, 1102, 100);
                edT = oItm.Top + nGap;
                oItm = addPaneItem(form, editCAmount, edL, edT, edW, edH, "Amount:", SAPbouiCOM.BoFormItemTypes.it_EDIT, 0, 1103, 100);
                edT = oItm.Top + nGap;
                setFormEditVal(form, editCustomerID, JobCustID);
            }
            oItm = addPaneItem(form, cbFrequency, edL, edT, edW, edH, "Frequency:", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX, 0, 1, 100);
            SAPbouiCOM.ComboBox oCB = (SAPbouiCOM.ComboBox)form.Items.Item(cbFrequency).Specific;
            oCB.ValidValues.Add(F_Daily, F_Daily);
            oCB.ValidValues.Add(F_Weekly, F_Weekly);
            oCB.ValidValues.Add(F_Biweekly, F_Biweekly);
            oCB.ValidValues.Add(F_Monthly, F_Monthly);
            oCB.ValidValues.Add(F_Bimonthly, F_Bimonthly);
            oCB.ValidValues.Add(F_Quarterly, F_Quarterly);
            oCB.ValidValues.Add(F_Semiannually, F_Semiannually);
            oCB.ValidValues.Add(F_Annually, F_Annually);
            oCB.Select(F_Monthly);
            edT = oItm.Top + nGap;
            oItm = addPaneItem(form, editDescription, edL, edT, edW, edH, "Description:", SAPbouiCOM.BoFormItemTypes.it_EDIT, 0, 3, 100);
            edT = oItm.Top + nGap;
            oItm = addPaneItem(form, editStartDate, edL, edT, edW, edH, "Start Date:", SAPbouiCOM.BoFormItemTypes.it_EDIT, 0, 4, 100);
            edT = oItm.Top + nGap;
            oItm = addPaneItem(form, editEndDate, edL, edT, edW, edH, "End Date:", SAPbouiCOM.BoFormItemTypes.it_EDIT, 0, 110, 100);
            edT = oItm.Top + nGap;
            if (SODocEntry != "")
            {
                oItm = addPaneItem(form, stOrderID, edL, edT, edW, edH, "Base On Order ID:", SAPbouiCOM.BoFormItemTypes.it_STATIC, 0, 109, 100);
                edT = oItm.Top + nGap;
            }
            else
            {
                oItm = addPaneItem(form, stOrderID, edL, edT, edW, edH, "", SAPbouiCOM.BoFormItemTypes.it_STATIC, 0, 109, 100);
                edT = oItm.Top + nGap;

            }
            oItm = addPaneItem(form, stCancel, edL, edT, edW, edH, "", SAPbouiCOM.BoFormItemTypes.it_STATIC, 0, 111, 100);

        }
        catch (Exception ex)
        {

            errorLog(ex);
        }
    }
Exemple #26
0
        private void SBO_Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;

            try
            {
                #region FormGR
                if (pVal.FormType.Equals(721))
                {
                    if (!pVal.BeforeAction)
                    {
                        switch (pVal.EventType)
                        {
                        case SAPbouiCOM.BoEventTypes.et_FORM_LOAD:
                            mFrmGR = Application.SBO_Application.Forms.ActiveForm;
                            break;



                        case SAPbouiCOM.BoEventTypes.et_FORM_DEACTIVATE:
                            mFrmGR = Application.SBO_Application.Forms.ActiveForm;
                            string typeFormD = mFrmGR.UDFFormUID;
                            if (mFrmGR.Type == 721)
                            {
                                if (typeFormD != "")
                                {
                                    SAPbouiCOM.Form oUDFFrm = Application.SBO_Application.Forms.Item(typeFormD);
                                    txtValue     = ((SAPbouiCOM.EditText)oUDFFrm.Items.Item("U_PE_ChargeTo").Specific).Value;
                                    mStrCardCode = ((SAPbouiCOM.EditText)oUDFFrm.Items.Item("U_GLO_BusinessPartner").Specific).Value;
                                    mStrChekIn   = ((SAPbouiCOM.EditText)oUDFFrm.Items.Item("U_GLO_CheckIn").Specific).Value;
                                    mStrDocDate  = ((SAPbouiCOM.EditText)mFrmGR.Items.Item("9").Specific).Value;
                                    //mStrFoodType = mObjCbFoodType != null ? mObjCbFoodType.Value : string.Empty;
                                    mStrFoodType = ((SAPbouiCOM.ComboBox)oUDFFrm.Items.Item("U_SU_FoodType").Specific).Value;
                                }
                            }
                            break;

                        case SAPbouiCOM.BoEventTypes.et_FORM_CLOSE:
                            mObjFormUDF = null;
                            break;
                        }
                    }
                    else
                    {
                        switch (pVal.EventType)
                        {
                        case SAPbouiCOM.BoEventTypes.et_KEY_DOWN:
                            if (pVal.CharPressed == 13)
                            {
                                mFrmGR = Application.SBO_Application.Forms.ActiveForm;
                                string typeFormE = mFrmGR.UDFFormUID;
                                if (mFrmGR.Type == 721)
                                {
                                    if (typeFormE != "")
                                    {
                                        SAPbouiCOM.Form oUDFFrm = Application.SBO_Application.Forms.Item(typeFormE);
                                        txtValue     = ((SAPbouiCOM.EditText)oUDFFrm.Items.Item("U_PE_ChargeTo").Specific).Value;
                                        mStrCardCode = ((SAPbouiCOM.EditText)oUDFFrm.Items.Item("U_GLO_BusinessPartner").Specific).Value;
                                        mStrChekIn   = ((SAPbouiCOM.EditText)oUDFFrm.Items.Item("U_GLO_CheckIn").Specific).Value;
                                        mStrDocDate  = ((SAPbouiCOM.EditText)mFrmGR.Items.Item("9").Specific).Value;
                                        mStrFoodType = mObjCbFoodType.Value;
                                    }
                                }
                            }
                            break;
                        }
                    }
                }
                if (pVal.FormType.Equals(-721))
                {
                    if (!pVal.BeforeAction)
                    {
                        switch (pVal.EventType)
                        {
                        case SAPbouiCOM.BoEventTypes.et_FORM_LOAD:
                            if (mObjFormUDF == null)
                            {
                                mObjFormUDF = SAPbouiCOM.Framework.Application.SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount);
                                initCombo(mObjFormUDF);
                            }
                            break;

                        case SAPbouiCOM.BoEventTypes.et_FORM_ACTIVATE:
                            if (mObjFormUDF == null)
                            {
                                mObjFormUDF = SAPbouiCOM.Framework.Application.SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount);

                                initCombo(mObjFormUDF);
                            }
                            break;
                        }
                    }
                }

                #endregion

                #region FormBatch
                if (pVal.FormType.Equals(41))
                {
                    if (!pVal.BeforeAction)
                    {
                        switch (pVal.EventType)
                        {
                        case SAPbouiCOM.BoEventTypes.et_FORM_LOAD:
                            mFrmBatches = Application.SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount);
                            AddButton();

                            break;

                        case SAPbouiCOM.BoEventTypes.et_CLICK:
                            if (pVal.ItemUID == "btnBatch")
                            {
                                SAPbouiCOM.Matrix   lObjMtxBatch = (SAPbouiCOM.Matrix)mFrmBatches.Items.Item("3").Specific;
                                SAPbouiCOM.ComboBox lObjCbFood   = (SAPbouiCOM.ComboBox)lObjMtxBatch.Columns.Item("U_GLO_Food3").Cells.Item(1).Specific;
                                SAPbouiCOM.ComboBox lObjCbPaymnt = (SAPbouiCOM.ComboBox)lObjMtxBatch.Columns.Item("U_SU_Payment").Cells.Item(1).Specific;

                                if (ValidateGetBatchName())
                                {
                                    for (int i = 1; i < lObjMtxBatch.Columns.Item(1).Cells.Count + 1; i++)
                                    {
                                        ((SAPbouiCOM.EditText)lObjMtxBatch.Columns.Item("2").Cells.Item(i).Specific).Value          = GetBatchName();
                                        ((SAPbouiCOM.EditText)lObjMtxBatch.Columns.Item("7").Cells.Item(i).Specific).Value          = mStrCardCode;
                                        ((SAPbouiCOM.EditText)lObjMtxBatch.Columns.Item("U_GLO_Time").Cells.Item(i).Specific).Value = mStrChekIn;


                                        lObjCbFood.Select(mIntFoodType, SAPbouiCOM.BoSearchKey.psk_Index);
                                        lObjCbPaymnt.Select(mIntCharged, SAPbouiCOM.BoSearchKey.psk_Index);



                                        lObjMtxBatch.Columns.Item("10").Cells.Item(i).Click();
                                    }
                                }
                            }

                            break;

                        case SAPbouiCOM.BoEventTypes.et_FORM_CLOSE:
                            string typeForm = mFrmGR.UDFFormUID;
                            if (mFrmGR.Type == 41)
                            {
                                if (typeForm != "")
                                {
                                    SAPbouiCOM.Form oUDFFrm = Application.SBO_Application.Forms.Item(typeForm);
                                    txtValue     = ((SAPbouiCOM.EditText)oUDFFrm.Items.Item("U_PE_ChargeTo").Specific).Value;
                                    mStrCardCode = ((SAPbouiCOM.EditText)oUDFFrm.Items.Item("U_GLO_BusinessPartner").Specific).Value;
                                    mStrChekIn   = ((SAPbouiCOM.EditText)oUDFFrm.Items.Item("U_GLO_CheckIn").Specific).Value;
                                    mStrDocDate  = ((SAPbouiCOM.EditText)mFrmGR.Items.Item("9").Specific).Value;
                                }
                            }
                            break;
                        }
                    }
                }
                #endregion
            }
            catch (Exception ex)
            {
                LogService.WriteError(ex);
                SAPbouiCOM.Framework.Application.SBO_Application.MessageBox(string.Format("ItemEventException: {0}", ex.Message));
            }
        }
    private void CustImpFormHandler(SAPbouiCOM.Form form, SAPbouiCOM.ItemEvent pVal)
    {
        try
        {
            if (pVal.BeforeAction)
            {
            }
            else
            {
                switch (pVal.EventType)
                {
                case SAPbouiCOM.BoEventTypes.et_CLICK:

                    break;

                case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED:
                {
                    switch (pVal.ItemUID)
                    {
                    case btnClose:
                        oCustImpForm.Close();
                        break;

                    case btnImp:
                        try
                        {
                            if (custObjForImport == null)
                            {
                                form.Items.Item(btnFind).Click();
                            }
                            else
                            {
                                string cardcode = getComboBoxVal(form, cbCustomerID);
                                if (cardcode == "")
                                {
                                    showMessage("Please select a customer.");
                                }
                                else
                                {
                                    if (custObjForImport == null)
                                    {
                                        form.Items.Item(btnFind).Click();
                                    }
                                    else
                                    {
                                        if (SBO_Application.MessageBox("Import payment method(s) to " + cardcode + "?", 1, "Yes", "No") == 1)
                                        {
                                            int i = 0;
                                            foreach (PaymentMethod pm in custObjForImport.PaymentMethods)
                                            {
                                                if (!isPaymentMethodExists(cardcode, pm.CardNumber, pm.CardExpiration))
                                                {
                                                    CCCUST cccust = new CCCUST();
                                                    cccust.CustomerID = cardcode;
                                                    cccust.active     = 'Y';
                                                    cccust.email      = custObjForImport.BillingAddress.Email;
                                                    cccust.firstName  = custObjForImport.BillingAddress.FirstName;
                                                    cccust.lastName   = custObjForImport.BillingAddress.LastName;
                                                    cccust.street     = custObjForImport.BillingAddress.Street;
                                                    cccust.city       = custObjForImport.BillingAddress.City;
                                                    cccust.state      = custObjForImport.BillingAddress.State;
                                                    cccust.zip        = custObjForImport.BillingAddress.Zip;
                                                    cccust.expDate    = pm.CardExpiration;
                                                    cccust.cardCode   = pm.CardCode;

                                                    cccust.routingNumber   = pm.Routing;
                                                    cccust.checkingAccount = pm.Account;
                                                    cccust.GroupName       = getGroupName(cardcode);
                                                    cccust.CustNum         = custObjForImport.CustNum;
                                                    cccust.MethodID        = pm.MethodID;
                                                    try
                                                    {
                                                        if (pm.MethodName != null && pm.MethodName != "")
                                                        {
                                                            if (pm.MethodName.IndexOf(" ") > 0)
                                                            {
                                                                string   name = pm.MethodName;
                                                                string[] s    = name.Split(' ');

                                                                cccust.firstName = s[0];
                                                                cccust.lastName  = s[s.Length - 1];
                                                            }
                                                        }
                                                    }
                                                    catch (Exception) { }
                                                    int    id   = getNextTableID("@CCCUST");
                                                    string desc = cccust.firstName + " " + cccust.lastName;
                                                    if (pm.MethodName != null && pm.MethodName != "")
                                                    {
                                                        desc = pm.MethodName;
                                                    }
                                                    if (pm.MethodType == "check")
                                                    {
                                                        cccust.methodDescription = id.ToString() + "_" + pm.Routing + " " + pm.Account + "(" + desc + ")";
                                                        cccust.checkingAccount   = pm.Account;
                                                        cccust.routingNumber     = pm.Routing;
                                                    }
                                                    else
                                                    {
                                                        cccust.cardNum           = pm.CardNumber;
                                                        cccust.methodDescription = id.ToString() + "_" + pm.CardNumber + " " + pm.CardExpiration + "(" + desc + ")";
                                                        cccust.checkingAccount   = pm.Account;
                                                        cccust.cardType          = pm.CardType;
                                                    }
                                                    string cardid = "";
                                                    cccust.CardName    = getCardName(cccust.GroupName, cccust.cardType, "", ref cardid);
                                                    cccust.CCAccountID = cardid;
                                                    cccust.methodName  = pm.MethodName;
                                                    insert(cccust);
                                                    SBO_Application.SetStatusBarMessage(string.Format("Import payment method {0} to {1}.", cccust.cardNum, cardcode), SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                                                }
                                                i++;
                                            }
                                        }
                                    }
                                }
                            }
                        }catch (Exception ex)
                        {
                            SBO_Application.SetStatusBarMessage(string.Format("Import payment method error: {0}.", ex.Message), SAPbouiCOM.BoMessageTime.bmt_Medium, true);
                        }
                        break;

                    case btnFind:
                        try
                        {
                            string custNum = getFormEditVal(form, editCustNum);
                            if (custNum == "")
                            {
                                showMessage("Please enter customer number.");
                            }
                            else
                            {
                                SBO_Application.SetStatusBarMessage("Finding customer please wait...", SAPbouiCOM.BoMessageTime.bmt_Medium, false);

                                ueSecurityToken token = getToken("");
                                custObjForImport = ebiz.getCustomer(token, custNum);
                                SAPbouiCOM.ComboBox oCB = (SAPbouiCOM.ComboBox)form.Items.Item(cbPaymentMethod).Specific;
                                try
                                {
                                    while (oCB.ValidValues.Count > 0)
                                    {
                                        oCB.ValidValues.Remove(0, SAPbouiCOM.BoSearchKey.psk_Index);
                                    }
                                }
                                catch (Exception)
                                { }
                                ComboAddItem(oCB, "");
                                foreach (PaymentMethod pm in custObjForImport.PaymentMethods)
                                {
                                    string s    = "";
                                    string name = "";
                                    name = custObjForImport.BillingAddress.FirstName + " " + custObjForImport.BillingAddress.LastName;
                                    if (pm.MethodName != null && pm.MethodName != "")
                                    {
                                        if (pm.MethodName.IndexOf(" ") > 0)
                                        {
                                            name = pm.MethodName;
                                        }
                                    }
                                    if (pm.MethodType == "check")
                                    {
                                        s = pm.Routing + " " + pm.Account + "(" + name + ")";
                                    }
                                    else
                                    {
                                        s = pm.CardNumber + " " + pm.CardExpiration + "(" + name + ")";
                                    }
                                    ComboAddItem(oCB, s);
                                }
                                oCB.Select("");
                                SBO_Application.SetStatusBarMessage(string.Format("{0} payment method(s) ready to import.", oCB.ValidValues.Count - 1), SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                                // form.Items.Item(btnImp).Click();
                            }
                        }catch (Exception ex)
                        {
                            custObjForImport = null;
                            SAPbouiCOM.ComboBox oCB = (SAPbouiCOM.ComboBox)form.Items.Item(cbPaymentMethod).Specific;
                            try
                            {
                                while (oCB.ValidValues.Count > 0)
                                {
                                    oCB.ValidValues.Remove(0, SAPbouiCOM.BoSearchKey.psk_Index);
                                }
                            }
                            catch (Exception)
                            { }
                            ComboAddItem(oCB, "");
                            oCB.Select("");
                            SBO_Application.SetStatusBarMessage(string.Format("Find customer error: {0}.", ex.Message), SAPbouiCOM.BoMessageTime.bmt_Medium, true);

                            errorLog(ex);
                        }
                        break;
                    }
                }
                break;
                }
            }
        }
        catch (Exception ex)
        {
            errorLog(ex);
        }
    }