Пример #1
0
        public FNINV001 GetHeaderDetail(string CmpyCode, string FNINV001_CODE, string BRANCHCODE)
        {
            ds = _EzBusinessHelper.ExecuteDataSet("Select SalesMan,vessel_code,POL,POD,SUPPLIER_JV_NO from FNINV001 where Flag=0 and FNINV001_CODE='" + FNINV001_CODE + "' and CMPYCODE='" + CmpyCode + "' and BRANCHCODE='" + BRANCHCODE + "'");// CMPYCODE='" + CmpyCode + "' and
            dt = ds.Tables[0];
            DataRowCollection drc     = dt.Rows;
            FNINV001          ObjList = new FNINV001();

            foreach (DataRow dr in drc)
            {
                ObjList.SUPPLIER_JV_NO = dr["SUPPLIER_JV_NO"].ToString();

                //ObjList.SUPPLIER_GRN_NO = dr["SUPPLIER_GRN_NO"].ToString();

                ObjList.SalesMan = dr["SalesMan"].ToString();

                ObjList.vessel_code = dr["vessel_code"].ToString();

                ObjList.POL = dr["POL"].ToString();
                ObjList.POD = dr["POD"].ToString();
            }
            return(ObjList);
        }
Пример #2
0
        public FNINV001_VM SaveFNINV_VM(FNINV001_VM FNINV)
        {
            DateTime dte;
            string   dtstr1, dtstr2, dtstr3, dtstr4;

            dte    = Convert.ToDateTime(DateTime.Now.ToString());
            dtstr1 = dte.ToString("yyyy-MM-dd hh:mm:ss tt");
            dte    = Convert.ToDateTime(FNINV.SUPPLIER_JV_DATE);
            dtstr2 = dte.ToString("yyyy-MM-dd hh:mm:ss tt");
            dte    = Convert.ToDateTime(FNINV.Post_Date);
            dtstr3 = dte.ToString("yyyy-MM-dd hh:mm:ss tt");
            dte    = Convert.ToDateTime(FNINV.INV_DATE);
            dtstr4 = dte.ToString("yyyy-MM-dd hh:mm:ss tt");

            if (!FNINV.EditFlag)
            {
                try
                {
                    using (TransactionScope scope1 = new TransactionScope())
                    {
                        #region FNINV002
                        List <FNINV002> ObjList = new List <FNINV002>();
                        if (FNINV.FNINV002Detail != null)
                        {
                            ObjList.AddRange(FNINV.FNINV002Detail.Select(m => new FNINV002
                            {
                                BRANCHCODE       = m.BRANCHCODE,
                                COA_CODE         = m.COA_CODE,
                                cmpycode         = m.cmpycode,
                                Cost_per_qty     = m.Cost_per_qty,
                                INV001_CODE      = m.INV001_CODE,
                                ITEMCODE         = m.ITEMCODE,
                                Item_Description = m.Item_Description,
                                O_VAT_CURR_AMT   = m.O_VAT_CURR_AMT,
                                VAT_GL_CODE      = m.VAT_GL_CODE,
                                LINE_NO          = m.LINE_NO,
                                Location_Code    = m.Location_Code,
                                Narration        = m.Narration,
                                NOTE             = m.NOTE,
                                NO_OF_QTY        = m.NO_OF_QTY,
                                O_CHARGE_UID     = m.O_CHARGE_UID,
                                O_CURR_AMT       = m.O_CURR_AMT,
                                O_CURR_CODE      = m.O_CURR_CODE,
                                O_CURR_RATE      = m.O_CURR_RATE,
                                O_LOCAL_AMT      = m.O_LOCAL_AMT,
                                O_VAT_LOCAL_AMT  = m.O_VAT_LOCAL_AMT,
                                RATE_PER_QTY     = m.RATE_PER_QTY,
                                Ret_Qty          = m.Ret_Qty,
                                SUBLEDGER_CODE   = m.SUBLEDGER_CODE,
                                UNIT_TYPE        = m.UNIT_TYPE,
                                VAT_CODE         = m.VAT_CODE,
                                VAT_PER          = m.VAT_PER,
                                V_CURR_AMT       = m.V_CURR_AMT,
                                V_LOCAL_AMT      = m.V_LOCAL_AMT,
                                V_NET_CURR_AMT   = m.V_NET_CURR_AMT,
                                V_NET_LOCAL_AMT  = m.V_NET_LOCAL_AMT,
                                V_VAT_CURR_AMT   = m.V_VAT_CURR_AMT,
                                V_VAT_LOCAL_AMT  = m.V_VAT_LOCAL_AMT,
                            }).ToList());
                        }

                        #endregion
                        //---
                        int n, i = 0;

                        #region FNINV002 INSERT LOOP
                        n = ObjList.Count;
                        while (n > 0)
                        {
                            int Stats1 = _EzBusinessHelper.ExecuteScalar("Select count(*) as [count1] from  FNINV002 where INV001_CODE='" + FNINV.FNINV001_CODE + "' and  CmpyCode='" + FNINV.cmpycode + "' and flag=0 and O_CHARGE_UID='" + ObjList[n - 1].O_CHARGE_UID + "'");// CmpyCode='" + FQV.CMPYCODE + "' and
                            if (Stats1 == 0)
                            {
                                StringBuilder sb5 = new StringBuilder();

                                sb5.Append("'" + FNINV.cmpycode + "',");
                                sb5.Append("'" + FNINV.BRANCHCODE + "',");
                                sb5.Append("'" + FNINV.FNINV001_CODE + "',");
                                sb5.Append("'" + n + "',");
                                sb5.Append("'" + ObjList[n - 1].O_CHARGE_UID + "',");
                                sb5.Append("'" + ObjList[n - 1].ITEMCODE + "',");
                                sb5.Append("'" + ObjList[n - 1].Item_Description + "',");
                                sb5.Append("'" + ObjList[n - 1].UNIT_TYPE + "',");
                                sb5.Append("'" + ObjList[n - 1].NO_OF_QTY + "',");
                                sb5.Append("'" + ObjList[n - 1].RATE_PER_QTY + "',");
                                sb5.Append("'" + ObjList[n - 1].COA_CODE + "',");
                                sb5.Append("'" + FNINV.SUBLEDGER_CODE + "',");
                                sb5.Append("'" + ObjList[n - 1].Location_Code + "',");
                                sb5.Append("'" + ObjList[n - 1].O_CURR_CODE + "',");
                                sb5.Append("'" + ObjList[n - 1].O_CURR_RATE + "',");
                                sb5.Append("'" + ObjList[n - 1].O_CURR_AMT + "',");
                                sb5.Append("'" + ObjList[n - 1].O_LOCAL_AMT + "',");
                                sb5.Append("'" + ObjList[n - 1].O_VAT_LOCAL_AMT + "',");
                                sb5.Append("'" + ObjList[n - 1].O_VAT_CURR_AMT + "',");
                                sb5.Append("'" + ObjList[n - 1].VAT_CODE + "',");
                                sb5.Append("'" + ObjList[n - 1].VAT_PER + "',");
                                sb5.Append("'" + ObjList[n - 1].VAT_GL_CODE + "',");
                                sb5.Append("'" + ObjList[n - 1].V_CURR_AMT + "',");
                                sb5.Append("'" + ObjList[n - 1].V_LOCAL_AMT + "',");
                                sb5.Append("'" + ObjList[n - 1].V_VAT_CURR_AMT + "',");
                                sb5.Append("'" + ObjList[n - 1].V_VAT_LOCAL_AMT + "',");
                                sb5.Append("'" + ObjList[n - 1].V_NET_CURR_AMT + "',");
                                sb5.Append("'" + ObjList[n - 1].V_NET_LOCAL_AMT + "',");
                                sb5.Append("'" + ObjList[n - 1].Narration + "',");
                                sb5.Append("'" + ObjList[n - 1].NOTE + "',");
                                sb5.Append("'" + ObjList[n - 1].Ret_Qty + "',");
                                sb5.Append("'" + ObjList[n - 1].Cost_per_qty + "')");


                                i = _EzBusinessHelper.ExecuteNonQuery("insert into FNINV002(cmpycode,BRANCHCODE,INV001_CODE,LINE_NO,O_CHARGE_UID,ITEMCODE,Item_Description,UNIT_TYPE,NO_OF_QTY,RATE_PER_QTY,COA_CODE,SUBLEDGER_CODE,Location_Code,O_CURR_CODE,O_CURR_RATE,O_CURR_AMT,O_LOCAL_AMT,O_VAT_LOCAL_AMT,O_VAT_CURR_AMT,VAT_CODE,VAT_PER,VAT_GL_CODE,V_CURR_AMT,V_LOCAL_AMT,V_VAT_CURR_AMT,V_VAT_LOCAL_AMT,V_NET_CURR_AMT,V_NET_LOCAL_AMT,Narration,NOTE,Ret_Qty,Cost_per_qty) values(" + sb5.ToString() + "");
                                //_EzBusinessHelper.ActivityLog(FQV.CMPYCODE, FQV.UserName, "Add FFM Charge", ObjList[n - 1].FF_BL001_CODE, Environment.MachineName);
                            }

                            n = n - 1;
                        }
                        #endregion

                        #region FNINV002 INSERT Header
                        //if (i > 0)
                        //{
                        StringBuilder sb4 = new StringBuilder();

                        sb4.Append("'" + FNINV.FNINV001_CODE + "',");
                        sb4.Append("'" + FNINV.cmpycode + "',");
                        sb4.Append("'" + FNINV.BRANCHCODE + "',");
                        sb4.Append("'" + FNINV.INV_TYPE + "',");
                        sb4.Append("'" + FNINV.INV_STATUS + "',");
                        sb4.Append("'" + dtstr4 + "',");
                        sb4.Append("'" + dtstr3 + "',");
                        sb4.Append("'" + FNINV.NOTES + "',");
                        sb4.Append("'" + FNINV.NARRATION + "',");
                        sb4.Append("'" + FNINV.CREATED_BY + "',");
                        sb4.Append("'" + dtstr1 + "',");
                        sb4.Append("'" + FNINV.UPDATED_BY + "',");
                        sb4.Append("'" + dtstr1 + "',");
                        sb4.Append("'" + FNINV.COA_CODE + "',");
                        sb4.Append("'" + FNINV.SUBLEDGER_CODE + "',");
                        sb4.Append("'" + FNINV.CURRENCY_CODE + "',");
                        sb4.Append("'" + FNINV.CURRENCY_RATE + "',");
                        sb4.Append("'" + FNINV.VAT_CURRENCY_AMT + "',");
                        sb4.Append("'" + FNINV.VAT_LOCAL_AMT + "',");
                        sb4.Append("'" + FNINV.CURRENCY_AMT + "',");
                        sb4.Append("'" + FNINV.LOCAL_AMT + "',");
                        sb4.Append("'" + FNINV.NET_CURRENCY_AMT + "',");
                        sb4.Append("'" + FNINV.NET_LOCAL_AMT + "',");
                        sb4.Append("'" + FNINV.BILLING_ADDRESS + "',");
                        sb4.Append("'" + FNINV.SUPPLIER_JV_NO + "',");
                        sb4.Append("'" + dtstr2 + "',");
                        sb4.Append("'" + FNINV.SUPPLIER_GRN_NO + "',");
                        sb4.Append("'" + FNINV.RECEIVED_PAID_NAME + "',");
                        sb4.Append("'" + FNINV.UNPOSTED_NOTE + "',");
                        sb4.Append("'" + FNINV.Received_By + "',");
                        sb4.Append("'" + FNINV.SalesMan + "',");
                        sb4.Append("'" + FNINV.LOCATION_CODE + "',");
                        sb4.Append("'" + FNINV.vessel_code + "',");
                        sb4.Append("'" + FNINV.BL_CODE + "',");
                        sb4.Append("'" + FNINV.BL_REF_NO + "',");
                        sb4.Append("'" + FNINV.POL + "',");
                        sb4.Append("'" + FNINV.POD + "')");
                        i = _EzBusinessHelper.ExecuteNonQuery("insert into FNINV001(FNINV001_CODE,cmpycode,BRANCHCODE,INV_TYPE,INV_STATUS,INV_DATE,Post_Date,NOTES,NARRATION,CREATED_BY,CREATED_ON,UPDATED_BY,UPDATED_ON,COA_CODE,SUBLEDGER_CODE,CURRENCY_CODE,CURRENCY_RATE,VAT_CURRENCY_AMT,VAT_LOCAL_AMT,CURRENCY_AMT,LOCAL_AMT,NET_CURRENCY_AMT,NET_LOCAL_AMT,BILLING_ADDRESS,SUPPLIER_JV_NO,SUPPLIER_JV_DATE,SUPPLIER_GRN_NO,RECEIVED_PAID_NAME,UNPOSTED_NOTE,Received_By,SalesMan,LOCATION_CODE,vessel_code,BL_CODE,BL_REF_NO,POL,POD) values(" + sb4.ToString() + "");

                        #endregion

                        _EzBusinessHelper.ActivityLog(FNINV.cmpycode, FNINV.UserName, "Update FF BL", FNINV.FNINV001_CODE, Environment.MachineName);
                        FNINV.SaveFlag     = true;
                        FNINV.ErrorMessage = string.Empty;
                        scope1.Complete();
                        //}
                        return(FNINV);
                    }
                }
                catch (Exception ex)
                {
                    FNINV.SaveFlag = false;
                }
            }
            else
            {
                try
                {
                    ds = _EzBusinessHelper.ExecuteDataSet("Select * from FNINV001 where CmpyCode='" + FNINV.cmpycode + "' and FNINV001_CODE='" + FNINV.FNINV001_CODE + "'");
                    using (TransactionScope scope1 = new TransactionScope())
                    {
                        FNINV001 FQT1 = new FNINV001();
                        dt = ds.Tables[0];
                        foreach (DataRow dr in dt.Rows)
                        {
                            FQT1.FNINV001_CODE    = FNINV.FNINV001_CODE;
                            FQT1.cmpycode         = FNINV.cmpycode;
                            FQT1.BRANCHCODE       = FNINV.BRANCHCODE;
                            FQT1.INV_TYPE         = FNINV.INV_TYPE;
                            FQT1.INV_STATUS       = FNINV.INV_STATUS;
                            FQT1.INV_DATE         = FNINV.INV_DATE;
                            FQT1.Post_Date        = FNINV.Post_Date;
                            FQT1.NOTES            = FNINV.NOTES;
                            FQT1.NARRATION        = FNINV.NARRATION;
                            FQT1.CREATED_BY       = FNINV.CREATED_BY;
                            FQT1.CREATED_ON       = FNINV.CREATED_ON;
                            FQT1.UPDATED_BY       = FNINV.UPDATED_BY;
                            FQT1.UPDATED_ON       = FNINV.UPDATED_ON;
                            FQT1.COA_CODE         = FNINV.COA_CODE;
                            FQT1.SUBLEDGER_CODE   = FNINV.SUBLEDGER_CODE;
                            FQT1.CURRENCY_CODE    = FNINV.CURRENCY_CODE;
                            FQT1.CURRENCY_RATE    = FNINV.CURRENCY_RATE;
                            FQT1.VAT_CURRENCY_AMT = FNINV.VAT_CURRENCY_AMT;
                            FQT1.VAT_LOCAL_AMT    = FNINV.VAT_LOCAL_AMT;
                            FQT1.CURRENCY_AMT     = FNINV.CURRENCY_AMT;
                            FQT1.LOCAL_AMT        = FNINV.LOCAL_AMT;
                            FQT1.NET_CURRENCY_AMT = FNINV.NET_CURRENCY_AMT;
                            FQT1.NET_LOCAL_AMT    = FNINV.NET_LOCAL_AMT;
                            FQT1.BILLING_ADDRESS  = FNINV.BILLING_ADDRESS;
                            FQT1.SUPPLIER_JV_NO   = FNINV.SUPPLIER_JV_NO;



                            _EzBusinessHelper.ExecuteNonQuery("delete from FNINV002 where CmpyCode='" + FNINV.cmpycode + "' and INV001_CODE='" + FNINV.FNINV001_CODE + "' AND BRANCHCODE ='" + FNINV.BRANCHCODE + "'");

                            // #region ObjectList
                            #region FNINV002
                            List <FNINV002> ObjList = new List <FNINV002>();
                            if (FNINV.FNINV002Detail != null)
                            {
                                ObjList.AddRange(FNINV.FNINV002Detail.Select(m => new FNINV002
                                {
                                    BRANCHCODE       = m.BRANCHCODE,
                                    COA_CODE         = m.COA_CODE,
                                    cmpycode         = m.cmpycode,
                                    Cost_per_qty     = m.Cost_per_qty,
                                    INV001_CODE      = m.INV001_CODE,
                                    ITEMCODE         = m.ITEMCODE,
                                    Item_Description = m.Item_Description,
                                    O_VAT_CURR_AMT   = m.O_VAT_CURR_AMT,
                                    VAT_GL_CODE      = m.VAT_GL_CODE,
                                    LINE_NO          = m.LINE_NO,
                                    Location_Code    = m.Location_Code,
                                    Narration        = m.Narration,
                                    NOTE             = m.NOTE,
                                    NO_OF_QTY        = m.NO_OF_QTY,
                                    O_CHARGE_UID     = m.O_CHARGE_UID,
                                    O_CURR_AMT       = m.O_CURR_AMT,
                                    O_CURR_CODE      = m.O_CURR_CODE,
                                    O_CURR_RATE      = m.O_CURR_RATE,
                                    O_LOCAL_AMT      = m.O_LOCAL_AMT,
                                    O_VAT_LOCAL_AMT  = m.O_VAT_LOCAL_AMT,
                                    RATE_PER_QTY     = m.RATE_PER_QTY,
                                    Ret_Qty          = m.Ret_Qty,
                                    SUBLEDGER_CODE   = m.SUBLEDGER_CODE,
                                    UNIT_TYPE        = m.UNIT_TYPE,
                                    VAT_CODE         = m.VAT_CODE,
                                    VAT_PER          = m.VAT_PER,
                                    V_CURR_AMT       = m.V_CURR_AMT,
                                    V_LOCAL_AMT      = m.V_LOCAL_AMT,
                                    V_NET_CURR_AMT   = m.V_NET_CURR_AMT,
                                    V_NET_LOCAL_AMT  = m.V_NET_LOCAL_AMT,
                                    V_VAT_CURR_AMT   = m.V_VAT_CURR_AMT,
                                    V_VAT_LOCAL_AMT  = m.V_VAT_LOCAL_AMT
                                }).ToList());
                            }

                            #endregion
                            //---
                            int n, i = 0;

                            #region FNINV002 INSERT LOOP
                            n = ObjList.Count;
                            while (n > 0)
                            {
                                int Stats1 = _EzBusinessHelper.ExecuteScalar("Select count(*) as [count1] from  FNINV002 where INV001_CODE='" + FNINV.FNINV001_CODE + "' and  CmpyCode='" + FNINV.cmpycode + "' and flag=0 AND BRANCHCODE ='" + FNINV.BRANCHCODE + "' and O_CHARGE_UID='" + ObjList[n - 1].O_CHARGE_UID + "'");// CmpyCode='" + FQV.CMPYCODE + "' and
                                if (Stats1 == 0)
                                {
                                    StringBuilder sb5 = new StringBuilder();

                                    sb5.Append("'" + FNINV.cmpycode + "',");
                                    sb5.Append("'" + FNINV.BRANCHCODE + "',");
                                    sb5.Append("'" + FNINV.FNINV001_CODE + "',");
                                    sb5.Append("'" + n + "',");
                                    sb5.Append("'" + ObjList[n - 1].O_CHARGE_UID + "',");
                                    sb5.Append("'" + ObjList[n - 1].ITEMCODE + "',");
                                    sb5.Append("'" + ObjList[n - 1].Item_Description + "',");
                                    sb5.Append("'" + ObjList[n - 1].UNIT_TYPE + "',");
                                    sb5.Append("'" + ObjList[n - 1].NO_OF_QTY + "',");
                                    sb5.Append("'" + ObjList[n - 1].RATE_PER_QTY + "',");
                                    sb5.Append("'" + ObjList[n - 1].COA_CODE + "',");
                                    sb5.Append("'" + FNINV.SUBLEDGER_CODE + "',");
                                    sb5.Append("'" + ObjList[n - 1].Location_Code + "',");
                                    sb5.Append("'" + ObjList[n - 1].O_CURR_CODE + "',");
                                    sb5.Append("'" + ObjList[n - 1].O_CURR_RATE + "',");
                                    sb5.Append("'" + ObjList[n - 1].O_CURR_AMT + "',");
                                    sb5.Append("'" + ObjList[n - 1].O_LOCAL_AMT + "',");
                                    sb5.Append("'" + ObjList[n - 1].O_VAT_LOCAL_AMT + "',");
                                    sb5.Append("'" + ObjList[n - 1].O_VAT_CURR_AMT + "',");
                                    sb5.Append("'" + ObjList[n - 1].VAT_CODE + "',");
                                    sb5.Append("'" + ObjList[n - 1].VAT_PER + "',");
                                    sb5.Append("'" + ObjList[n - 1].VAT_GL_CODE + "',");
                                    sb5.Append("'" + ObjList[n - 1].V_CURR_AMT + "',");
                                    sb5.Append("'" + ObjList[n - 1].V_LOCAL_AMT + "',");
                                    sb5.Append("'" + ObjList[n - 1].V_VAT_CURR_AMT + "',");
                                    sb5.Append("'" + ObjList[n - 1].V_VAT_LOCAL_AMT + "',");
                                    sb5.Append("'" + ObjList[n - 1].V_NET_CURR_AMT + "',");
                                    sb5.Append("'" + ObjList[n - 1].V_NET_LOCAL_AMT + "',");
                                    sb5.Append("'" + ObjList[n - 1].Narration + "',");
                                    sb5.Append("'" + ObjList[n - 1].NOTE + "',");
                                    sb5.Append("'" + ObjList[n - 1].Ret_Qty + "',");
                                    sb5.Append("'" + ObjList[n - 1].Cost_per_qty + "')");


                                    i = _EzBusinessHelper.ExecuteNonQuery("insert into FNINV002(cmpycode,BRANCHCODE,INV001_CODE,LINE_NO,O_CHARGE_UID,ITEMCODE,Item_Description,UNIT_TYPE,NO_OF_QTY,RATE_PER_QTY,COA_CODE,SUBLEDGER_CODE,Location_Code,O_CURR_CODE,O_CURR_RATE,O_CURR_AMT,O_LOCAL_AMT,O_VAT_LOCAL_AMT,O_VAT_CURR_AMT,VAT_CODE,VAT_PER,VAT_GL_CODE,V_CURR_AMT,V_LOCAL_AMT,V_VAT_CURR_AMT,V_VAT_LOCAL_AMT,V_NET_CURR_AMT,V_NET_LOCAL_AMT,Narration,NOTE,Ret_Qty,Cost_per_qty) values(" + sb5.ToString() + "");
                                    //_EzBusinessHelper.ActivityLog(FQV.CMPYCODE, FQV.UserName, "Add FFM Charge", ObjList[n - 1].FF_BL001_CODE, Environment.MachineName);
                                }

                                n = n - 1;
                            }
                            #endregion



                            #region FF_INV001 Update
                            StringBuilder sb9 = new StringBuilder();

                            sb9.Append("FNINV001_CODE='" + FNINV.FNINV001_CODE + "',");
                            sb9.Append("cmpycode='" + FNINV.cmpycode + "',");
                            sb9.Append("BRANCHCODE='" + FNINV.BRANCHCODE + "',");
                            sb9.Append("INV_TYPE='" + FNINV.INV_TYPE + "',");
                            sb9.Append("INV_STATUS='" + FNINV.INV_STATUS + "',");
                            sb9.Append("INV_DATE='" + dtstr4 + "',");
                            sb9.Append("Post_Date='" + dtstr3 + "',");
                            sb9.Append("NOTES='" + FNINV.NOTES + "',");
                            sb9.Append("NARRATION='" + FNINV.NARRATION + "',");
                            sb9.Append("CREATED_BY='" + FNINV.CREATED_BY + "',");
                            sb9.Append("CREATED_ON='" + dtstr1 + "',");
                            sb9.Append("UPDATED_BY='" + FNINV.UPDATED_BY + "',");
                            sb9.Append("UPDATED_ON='" + dtstr1 + "',");
                            sb9.Append("COA_CODE='" + FNINV.COA_CODE + "',");
                            sb9.Append("SUBLEDGER_CODE='" + FNINV.SUBLEDGER_CODE + "',");
                            sb9.Append("CURRENCY_CODE='" + FNINV.CURRENCY_CODE + "',");
                            sb9.Append("CURRENCY_RATE='" + FNINV.CURRENCY_RATE + "',");
                            sb9.Append("VAT_CURRENCY_AMT='" + FNINV.VAT_CURRENCY_AMT + "',");
                            sb9.Append("VAT_LOCAL_AMT='" + FNINV.VAT_LOCAL_AMT + "',");
                            sb9.Append("CURRENCY_AMT='" + FNINV.CURRENCY_AMT + "',");
                            sb9.Append("LOCAL_AMT='" + FNINV.LOCAL_AMT + "',");
                            sb9.Append("NET_CURRENCY_AMT='" + FNINV.NET_CURRENCY_AMT + "',");
                            sb9.Append("NET_LOCAL_AMT='" + FNINV.NET_LOCAL_AMT + "',");
                            sb9.Append("BILLING_ADDRESS='" + FNINV.BILLING_ADDRESS + "',");
                            sb9.Append("SUPPLIER_JV_NO='" + FNINV.SUPPLIER_JV_NO + "',");
                            sb9.Append("SUPPLIER_JV_DATE='" + dtstr2 + "',");
                            sb9.Append("SUPPLIER_GRN_NO='" + FNINV.SUPPLIER_GRN_NO + "',");
                            sb9.Append("RECEIVED_PAID_NAME='" + FNINV.RECEIVED_PAID_NAME + "',");
                            sb9.Append("UNPOSTED_NOTE='" + FNINV.UNPOSTED_NOTE + "',");
                            sb9.Append("Received_By='" + FNINV.Received_By + "',");
                            sb9.Append("SalesMan='" + FNINV.SalesMan + "',");
                            sb9.Append("LOCATION_CODE='" + FNINV.LOCATION_CODE + "',");
                            sb9.Append("vessel_code='" + FNINV.vessel_code + "',");
                            sb9.Append("BL_CODE='" + FNINV.BL_CODE + "',");
                            sb9.Append("BL_REF_NO='" + FNINV.BL_REF_NO + "',");
                            sb9.Append("POL='" + FNINV.POL + "',");
                            sb9.Append("POD='" + FNINV.POD + "'");

                            _EzBusinessHelper.ExecuteNonQuery("update FNINV001 set  " + sb9 + " where  FNINV001_CODE='" + FNINV.FNINV001_CODE + "' and  BRANCHCODE='" + FNINV.BRANCHCODE + "' and  cmpycode='" + FNINV.cmpycode + "' and Flag=0");//CmpyCode='" + FQV.CMPYCODE + "' and
                            // _EzBusinessHelper.ActivityLog(FQV.CMPYCODE, FQV.UserName, "Add FFM Voyage", ObjList[n - 1].FFM_VOYAGE01_CODE, Environment.MachineName);
                            #endregion

                            _EzBusinessHelper.ActivityLog(FNINV.cmpycode, FNINV.UserName, "Update FF FNINV001", FNINV.FNINV001_CODE, Environment.MachineName);
                        }

                        FNINV.ErrorMessage = string.Empty;
                        FNINV.SaveFlag     = true;
                        scope1.Complete();
                    }
                }
                catch (Exception ex)
                {
                    FNINV.ErrorMessage = "Error occur";
                    FNINV.SaveFlag     = false;
                }
            }

            return(FNINV);
        }