Ejemplo n.º 1
0
        private CGRMaster LoadImportedData(CMTMaster oMTMaster)
        {
            CGRMaster oGRMaster = new CGRMaster();

            oGRMaster.GRMstr_Branch = currentBranch.CompBrn_Branch;
            oGRMaster.GRMstr_By     = currentUser.User_OID;
            oGRMaster.GRMstr_RefBy  = oMTMaster.MTMstr_DOrder;
            oGRMaster.GRMstr_Type   = 0;
            oGRMaster.Creator       = currentUser.User_OID;
            oGRMaster.CreationDate  = DateTime.Now.Date;

            foreach (CMTDetails oMTDetails in oMTMaster.MTMstr_DetailsList)
            {
                CGRDetails oGRDetails = new CGRDetails();

                oGRDetails.GRDet_ItemOID = oMTDetails.MTDtls_ItemOID;
                oGRDetails.GRDet_QTY     = oMTDetails.MTDtls_IssQty;
                oGRDetails.GRDet_UOM     = oMTDetails.MTDtls_IssUOMOID;
                oGRDetails.GRDet_LocOID  = oMTDetails.MTDtls_DestLocOID;
                oGRDetails.GRDet_InvType = oMTDetails.MTDtls_DesInvtyp;

                oGRMaster.GRMstr_DetailsList.Add(oGRDetails);
            }

            return(oGRMaster);
        }
Ejemplo n.º 2
0
        void oSearch_SelectedEvent(object sender, SearchEventArgs <CMTMaster> e)
        {
            FormControlMode(1);
            CMTMaster oMTMaster = e.t;

            FillForm(oMTMaster);
        }
Ejemplo n.º 3
0
        private void FillForm(CMTMaster oMTMaster)
        {
            oMTExistingQtyDic.Clear();

            txtSelectedMTOID.Text = oMTMaster.MTMstr_OID.Trim();
            txtDeliverOrder.Text  = oMTMaster.MTMstr_DOrder;
            dtpMTDate.Value       = oMTMaster.MTMstr_Date;

            dgItemList.Rows.Clear();

            foreach (CMTDetails oMTDetails in oMTMaster.MTMstr_DetailsList)
            {
                dgItemList.Rows.Add();
                DataGridViewRow odgRow = dgItemList.Rows[dgItemList.Rows.Count - 2];

                odgRow.Cells["colItem"].Value        = oMTDetails.MTDtls_ItemOID.Trim();
                odgRow.Cells["colIssueqty"].Value    = oMTDetails.MTDtls_IssQty.ToString("F2");
                odgRow.Cells["colIssueUOM"].Value    = oMTDetails.MTDtls_IssUOMOID.Trim();
                odgRow.Cells["colSrcBranch"].Value   = oMTDetails.MTDtls_SBranOID.Trim();
                odgRow.Cells["colSourceLoc"].Value   = oMTDetails.MTDtls_SrcLocOID.Trim();
                odgRow.Cells["colSrcInvType"].Value  = Enum.GetName(typeof(EInvType), oMTDetails.MTDtls_SrcInvTyp);
                odgRow.Cells["colDesBranch"].Value   = oMTDetails.MTDtls_DBranOID.Trim();
                odgRow.Cells["colDesLocation"].Value = oMTDetails.MTDtls_DestLocOID.Trim();
                odgRow.Cells["colDesInvType"].Value  = Enum.GetName(typeof(EInvType), oMTDetails.MTDtls_DesInvtyp);

                if (IsUpdateMode)
                {
                    oMTExistingQtyDic.Add(oMTDetails.MTDtls_ItemOID.Trim(), oMTDetails);
                }
            }
        }
Ejemplo n.º 4
0
        private void btnExportItems_Click(object sender, EventArgs e)
        {
            if (txtDelvNO.Text.Trim() != "")
            {
                List <CMTMaster> olistMT   = new List <CMTMaster>();
                CMTMaster        oMTMaster = new CMTMaster();

                CMaterialTransferBO oMTBO   = new CMaterialTransferBO();
                CResult             oResult = new CResult();
                if (txtDelvNO.Text.Trim() != "")
                {
                    oResult = oMTBO.ReadByIDDate(DateTime.Now.Date, DateTime.Now.Date, txtDelvNO.Text.Trim());
                }

                if (oResult.IsSuccess)
                {
                    olistMT = (List <CMTMaster>)oResult.Data;

                    oMTMaster = (CMTMaster)olistMT[0];
                }
                else
                {
                    MessageBox.Show(oResult.ErrMsg.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    oMTMaster = null;
                }


                string m_sMTExportFileName = txtDelvNO.Text.Trim();

                saveFileDialog1.FileName         = m_sMTExportFileName;
                saveFileDialog1.InitialDirectory = @"H:\";
                saveFileDialog1.Filter           = "Delivery File (*.dlvexp)|*.dlvexp";

                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    m_sMTExportFileName = saveFileDialog1.FileName;

                    if (oMTMaster != null)
                    {
                        IFormatter formatter = new BinaryFormatter();
                        using (Stream stream = new FileStream(m_sMTExportFileName, FileMode.Create, FileAccess.Write, FileShare.None))
                        {
                            byte[]       baKey        = { 51, 208, 75, 59, 223, 134, 241, 155, 170, 229, 177, 160, 246, 71, 77, 141, 66, 7, 223, 103, 97, 80, 235, 82, 94, 107, 226, 190, 76, 94, 31, 43 };
                            byte[]       baIV         = { 142, 96, 41, 14, 206, 132, 173, 19, 12, 50, 124, 121, 42, 27, 35, 9 };
                            Rijndael     rijndael     = Rijndael.Create();
                            CryptoStream cryptoStream = new CryptoStream(stream, rijndael.CreateEncryptor(baKey, baIV), CryptoStreamMode.Write);

                            //
                            formatter.Serialize(cryptoStream, oMTMaster);
                            //

                            cryptoStream.Close();
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
            public CResult ReadMTMasterByOID(string stOID)
            {
                CMTMaster         oMTMaster      = new CMTMaster();
                List <CMTDetails> oMTDetailsList = new List <CMTDetails>();

                oResult = new CResult();
                conn    = oConnManager.GetConnection(out s_DBError);
                if (conn != null)
                {
                    try
                    {
                        DataSet    ds  = new DataSet();
                        SqlCommand cmd = new SqlCommand();

                        cmd.Connection  = conn;
                        cmd.CommandText = "sp_MTMstr_ReadByOID";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@MTMstr_OID", stOID);

                        SqlDataAdapter da = new SqlDataAdapter(cmd);
                        da.Fill(ds);

                        DataTable dtDetails = ds.Tables[0] as DataTable;
                        DataTable dtMaster  = ds.Tables[1] as DataTable;

                        oMTMaster = GetResultSetToMTMaster(dtMaster.Rows[0]);
                        foreach (DataRow dr in dtDetails.Rows)
                        {
                            oMTDetailsList.Add(GetResultSetToMTDtls(dr));
                        }
                        oMTMaster.MTMstr_DetailsList = oMTDetailsList;

                        oResult.IsSuccess = true;
                        oResult.Data      = oMTMaster;
                    }
                    catch (SqlException e)
                    {
                        oResult.IsSuccess = false;
                        oResult.ErrMsg    = e.Message;
                    }
                    finally
                    {
                        oConnManager.Close();
                    }
                }
                else
                {
                    oResult.IsSuccess = false;
                    oResult.ErrMsg    = s_DBError;
                }

                return(oResult);
            }
Ejemplo n.º 6
0
            private CMTMaster GetResultSetToMTMaster(DataRow dr)
            {
                CMTMaster oMTMaster = new CMTMaster();

                oMTMaster.MTMstr_OID    = dr["MTMstr_OID"].ToString();
                oMTMaster.MTMstr_Branch = dr["MTMstr_Branch"].ToString();
                oMTMaster.MTMstr_Code   = dr["MTMstr_Code"].ToString();
                oMTMaster.MTMstr_Date   = DateTime.Parse(dr["MTMstr_Date"].ToString()).Date;
                oMTMaster.MTMstr_DOrder = dr["MTMstr_DOrder"].ToString();
                oMTMaster.Creator       = dr["MTMstr_Creator"].ToString();
                oMTMaster.CreationDate  = DateTime.Parse(dr["MTMstr_CreationDate"].ToString()).Date;
                oMTMaster.UpdateBy      = dr["MTMstr_UpdatedBy"].ToString();
                oMTMaster.UpdateDate    = DateTime.Parse(dr["MTMstr_UpdateDate"].ToString()).Date;
                oMTMaster.IsActive      = dr["MTMstr_IsActive"].ToString();
                oMTMaster.Remarks       = dr["MTMstr_Remarks"].ToString();

                return(oMTMaster);
            }
Ejemplo n.º 7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ValidationData())
            {
                CResult             oResult             = new CResult();
                CMaterialTransferBO oMaterialTransferBO = new CMaterialTransferBO();
                CMTMaster           oMaster             = GetToBSavedData();

                if (oMaster != null)
                {
                    if (!IsUpdateMode)
                    {
                        oResult = oMaterialTransferBO.Create(oMaster);
                    }
                    else
                    {
                        oResult = oMaterialTransferBO.Update(oMaster, oMTFinalQtyDic);
                    }

                    if (oResult.IsSuccess)
                    {
                        if (currentBranch.CompBrn_IsHeadoffice == "Y")
                        {
                            if (MessageBox.Show("Successfully Done. Do u want to Export these data? ", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                            {
                                frmMTExpItems objMTExpItems = new frmMTExpItems(txtDeliverOrder.Text.Trim());
                                objMTExpItems.Show();
                            }
                        }
                        ClearFormData();
                        GetDeliverID();
                    }
                    else
                    {
                        MessageBox.Show(oResult.ErrMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Ejemplo n.º 8
0
            public CResult ReadByIDDate(DateTime dtFrom, DateTime dtTo, string sID)
            {
                List <CMTDetails> oMTDetailsList = new List <CMTDetails>();
                List <CMTMaster>  oMTMasterList  = new List <CMTMaster>();

                CResult oResult = new CResult();

                oResult.IsSuccess = false;
                conn = oConnManager.GetConnection(out s_DBError);
                if (conn != null)
                {
                    SqlCommand     cmd = new SqlCommand();
                    SqlDataAdapter da;
                    DataSet        ds;
                    cmd.Connection = conn;

                    cmd.Transaction = oConnManager.BeginTransaction();
                    try
                    {
                        cmd.CommandText = "sp_MTMaster_ReadByIDDate";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Clear();

                        if (sID == null)
                        {
                            cmd.Parameters.AddWithValue("@frmDate", dtFrom);
                            cmd.Parameters.AddWithValue("@toDate", dtTo);
                            cmd.Parameters.AddWithValue("@DOID", DBNull.Value);
                        }
                        else
                        {
                            cmd.Parameters.AddWithValue("@frmDate", dtFrom);
                            cmd.Parameters.AddWithValue("@toDate", dtTo);
                            cmd.Parameters.AddWithValue("@DOID", sID);
                        }

                        da = new SqlDataAdapter(cmd);
                        ds = new DataSet();
                        da.Fill(ds);
                        if (ds.Tables.Count > 0)
                        {
                            DataTable dtMaster  = ds.Tables[0] as DataTable;
                            DataTable dtDetails = ds.Tables[1] as DataTable;

                            foreach (DataRow dr in dtDetails.Rows)
                            {
                                oMTDetailsList.Add(GetResultSetToMTDtls(dr));
                            }

                            foreach (DataRow dr in dtMaster.Rows)
                            {
                                CMTMaster oMTMaster = new CMTMaster();
                                oMTMaster = GetResultSetToMTMaster(dr);
                                foreach (CMTDetails oMTDetails in oMTDetailsList)
                                {
                                    if (oMTDetails.MTDtls_MstrOID == oMTMaster.MTMstr_OID)
                                    {
                                        oMTMaster.MTMstr_DetailsList.Add(oMTDetails);
                                    }
                                }
                                oMTMasterList.Add(oMTMaster);
                            }
                        }

                        oResult.IsSuccess = true;
                        oResult.Data      = oMTMasterList;
                        oConnManager.Commit();
                    }
                    catch (SqlException e)
                    {
                        string sRollbackError = oConnManager.Rollback();

                        oResult.IsSuccess = false;
                        oResult.ErrMsg    = sRollbackError.Equals("") ? oConnManager.GetErrorMessage(e) : sRollbackError;
                    }
                    finally
                    {
                        oConnManager.Close();
                    }
                }
                else
                {
                    oResult.IsSuccess = false;
                    oResult.ErrMsg    = s_DBError;
                }

                return(oResult);
            }
Ejemplo n.º 9
0
            public CResult Create(CMTMaster oMTMaster)
            {
                List <CInventory> oSrcInvtList = new List <CInventory>();
                List <CInventory> oDesInvtList = new List <CInventory>();

                oResult = new CResult();
                conn    = oConnManager.GetConnection(out s_DBError);
                if (conn != null)
                {
                    SqlCommand cmd = new SqlCommand();
                    cmd.Connection = conn;

                    cmd.Transaction = oConnManager.BeginTransaction();
                    try
                    {
                        cmd.CommandText = "sp_MTMstr_Insert";
                        cmd.CommandType = CommandType.StoredProcedure;

                        //cmd.Parameters.AddWithValue("@MTMstr_OID", oMTMaster.MTMstr_OID);


                        SqlParameter sParam = new SqlParameter("@MTMstr_OID", SqlDbType.Char, 24);
                        sParam.Direction = ParameterDirection.Output;
                        cmd.Parameters.Add(sParam).Value = "";


                        cmd.Parameters.AddWithValue("@MTMstr_Branch", oMTMaster.MTMstr_Branch);
                        cmd.Parameters.AddWithValue("@MTMstr_Code", oMTMaster.MTMstr_Code);
                        cmd.Parameters.AddWithValue("@MTMstr_Date", oMTMaster.MTMstr_Date);
                        cmd.Parameters.AddWithValue("@MTMstr_DOrder", oMTMaster.MTMstr_DOrder);


                        cmd.Parameters.AddWithValue("@MTMstr_Creator", oMTMaster.Creator);
                        cmd.Parameters.AddWithValue("@MTMstr_CreationDate", oMTMaster.CreationDate);
                        cmd.Parameters.AddWithValue("@MTMstr_UpdatedBy", oMTMaster.UpdateBy);
                        cmd.Parameters.AddWithValue("@MTMstr_UpdateDate", oMTMaster.UpdateDate);
                        cmd.Parameters.AddWithValue("@MTMstr_IsActive", (oMTMaster.IsActive == "Y")?1:0);
                        cmd.Parameters.AddWithValue("@MTMstr_Remarks", oMTMaster.Remarks);


                        cmd.ExecuteNonQuery();

                        string stMTMstr_OID = cmd.Parameters["@MTMstr_OID"].Value.ToString();

                        foreach (CMTDetails oDetails in oMTMaster.MTMstr_DetailsList)
                        {
                            cmd.CommandText = "sp_MTDtls_Insert";
                            cmd.CommandType = CommandType.StoredProcedure;
                            cmd.Parameters.Clear();
                            cmd.Parameters.AddWithValue("@MTDtls_Branch", oDetails.MTDtls_Branch);
                            cmd.Parameters.AddWithValue("@MTDtls_OID", oDetails.MTDtls_OID);
                            cmd.Parameters.AddWithValue("@MTDtls_MstrOID", stMTMstr_OID);
                            cmd.Parameters.AddWithValue("@MTDtls_ItemOID", oDetails.MTDtls_ItemOID);
                            cmd.Parameters.AddWithValue("@MTDtls_IssQty", oDetails.MTDtls_IssQty);
                            cmd.Parameters.AddWithValue("@MTDtls_IssUOMOID", oDetails.MTDtls_IssUOMOID);
                            cmd.Parameters.AddWithValue("@MTDtls_SBranOID", oDetails.MTDtls_SBranOID);
                            cmd.Parameters.AddWithValue("@MTDtls_SrcLocOID", oDetails.MTDtls_SrcLocOID);
                            cmd.Parameters.AddWithValue("@MTDtls_SrcInvTyp", oDetails.MTDtls_SrcInvTyp);
                            cmd.Parameters.AddWithValue("@MTDtls_DBranOID", oDetails.MTDtls_DBranOID);
                            cmd.Parameters.AddWithValue("@MTDtls_DestLocOID", oDetails.MTDtls_DestLocOID);
                            cmd.Parameters.AddWithValue("@MTDtls_DesInvtyp", oDetails.MTDtls_DesInvtyp);
                            cmd.Parameters.AddWithValue("@MTDtls_RQty", oDetails.MTDtls_RQty);
                            cmd.Parameters.AddWithValue("@MTDtls_RUOMOID", oDetails.MTDtls_RUOMOID);
                            cmd.Parameters.AddWithValue("@MTDtls_Status", oDetails.MTDtls_Status);

                            cmd.ExecuteNonQuery();

                            // populate inv list(decrease)
                            CInventory oInventory = new CInventory();

                            oInventory.Invt_Branch    = oDetails.MTDtls_Branch;
                            oInventory.Invt_BranchOID = oDetails.MTDtls_SBranOID;
                            oInventory.Invt_InvType   = oDetails.MTDtls_SrcInvTyp;
                            oInventory.Invt_ItemOID   = oDetails.MTDtls_ItemOID;
                            oInventory.Invt_LocOID    = oDetails.MTDtls_SrcLocOID;
                            oInventory.Invt_QTY       = oDetails.MTDtls_IssQty;

                            oSrcInvtList.Add(oInventory);

                            // populate inv list(increase)
                            oInventory = new CInventory();

                            oInventory.Invt_Branch    = oDetails.MTDtls_Branch;
                            oInventory.Invt_BranchOID = oDetails.MTDtls_DBranOID;
                            oInventory.Invt_InvType   = oDetails.MTDtls_DesInvtyp;
                            oInventory.Invt_ItemOID   = oDetails.MTDtls_ItemOID;
                            oInventory.Invt_LocOID    = oDetails.MTDtls_DestLocOID;
                            oInventory.Invt_QTY       = oDetails.MTDtls_IssQty;

                            oDesInvtList.Add(oInventory);
                        }

                        //Update inv

                        CInventoryBO oInventoryBO = new CInventoryBO();
                        oResult = oInventoryBO.InvtDecInc(oSrcInvtList, oDesInvtList);

                        if (oResult.IsSuccess)
                        {
                            oConnManager.Commit();
                            oResult.IsSuccess = true;
                        }
                        else
                        {
                            oResult.ErrMsg    = oConnManager.Rollback();
                            oResult.IsSuccess = false;
                        }
                    }
                    catch (SqlException e)
                    {
                        string sRollbackError = oConnManager.Rollback();

                        oResult.IsSuccess = false;
                        oResult.ErrMsg    = sRollbackError.Equals("") ? oConnManager.GetErrorMessage(e) : sRollbackError;
                    }
                    finally
                    {
                        oConnManager.Close();
                    }
                }
                else
                {
                    oResult.IsSuccess = false;
                    oResult.ErrMsg    = s_DBError;
                }

                return(oResult);
            }
Ejemplo n.º 10
0
        private CMTMaster GetToBSavedData()
        {
            oMTFinalQtyDic.Clear();

            CMTMaster oMTMaster = new CMTMaster();

            oMTMaster.MTMstr_OID    = txtSelectedMTOID.Text.Trim();
            oMTMaster.MTMstr_DOrder = txtDeliverOrder.Text.Trim();
            oMTMaster.MTMstr_Branch = currentBranch.CompBrn_Code;
            oMTMaster.MTMstr_Date   = dtpMTDate.Value.Date;

            oMTMaster.Creator      = currentUser.User_OID;
            oMTMaster.CreationDate = DateTime.Now.Date;
            oMTMaster.UpdateBy     = currentUser.User_OID;
            oMTMaster.UpdateDate   = DateTime.Now.Date;
            oMTMaster.IsActive     = "Y";
            oMTMaster.Remarks      = "";

            for (int i = 0; i < dgItemList.Rows.Count - 1; i++)
            {
                if (ValidateListItem(dgItemList.Rows[i]))
                {
                    CMTDetails oMTDetails = new CMTDetails();

                    oMTDetails.MTDtls_Branch  = currentBranch.CompBrn_Code;
                    oMTDetails.MTDtls_ItemOID = ((DataGridViewComboBoxCell)dgItemList.Rows[i].Cells["colItem"]).Value.ToString();
                    if (dgItemList.Rows[i].Cells["colIssueqty"].Value != null)
                    {
                        oMTDetails.MTDtls_IssQty = float.Parse(((DataGridViewTextBoxCell)dgItemList.Rows[i].Cells["colIssueqty"]).Value.ToString());
                    }
                    if (dgItemList.Rows[i].Cells["colIssueUOM"].Value != null)
                    {
                        oMTDetails.MTDtls_IssUOMOID = ((DataGridViewComboBoxCell)dgItemList.Rows[i].Cells["colIssueUOM"]).Value.ToString();
                    }

                    if (dgItemList.Rows[i].Cells["colSrcBranch"].Value != null)
                    {
                        oMTDetails.MTDtls_SBranOID = ((DataGridViewComboBoxCell)dgItemList.Rows[i].Cells["colSrcBranch"]).Value.ToString();
                    }

                    if (dgItemList.Rows[i].Cells["colSourceLoc"].Value != null)
                    {
                        oMTDetails.MTDtls_SrcLocOID = ((DataGridViewComboBoxCell)dgItemList.Rows[i].Cells["colSourceLoc"]).Value.ToString();
                    }

                    if (dgItemList.Rows[i].Cells["colSrcInvType"].Value != null)
                    {
                        oMTDetails.MTDtls_SrcInvTyp = Convert.ToInt32(Enum.Parse(typeof(EInvType), ((DataGridViewComboBoxCell)dgItemList.Rows[i].Cells["colSrcInvType"]).Value.ToString()));
                    }
                    if (dgItemList.Rows[i].Cells["colDesBranch"].Value != null)
                    {
                        oMTDetails.MTDtls_DBranOID = ((DataGridViewComboBoxCell)dgItemList.Rows[i].Cells["colDesBranch"]).Value.ToString();
                    }

                    if (dgItemList.Rows[i].Cells["colDesLocation"].Value != null)
                    {
                        oMTDetails.MTDtls_DestLocOID = ((DataGridViewComboBoxCell)dgItemList.Rows[i].Cells["colDesLocation"]).Value.ToString();
                    }
                    if (dgItemList.Rows[i].Cells["colDesInvType"].Value != null)
                    {
                        oMTDetails.MTDtls_DesInvtyp = Convert.ToInt32(Enum.Parse(typeof(EInvType), ((DataGridViewComboBoxCell)dgItemList.Rows[i].Cells["colDesInvType"]).Value.ToString()));
                    }

                    oMTMaster.MTMstr_DetailsList.Add(oMTDetails);

                    //update inmv
                    if (IsUpdateMode)
                    {
                        CMTDetails oInvMTDetails = new CMTDetails();

                        oInvMTDetails.MTDtls_ItemOID   = oMTDetails.MTDtls_ItemOID;
                        oInvMTDetails.MTDtls_Branch    = oMTDetails.MTDtls_Branch;
                        oInvMTDetails.MTDtls_SBranOID  = oMTDetails.MTDtls_SBranOID;
                        oInvMTDetails.MTDtls_SrcLocOID = oMTDetails.MTDtls_SrcLocOID;
                        oInvMTDetails.MTDtls_SrcInvTyp = oMTDetails.MTDtls_SrcInvTyp;

                        oInvMTDetails.MTDtls_DBranOID   = oMTDetails.MTDtls_DBranOID;
                        oInvMTDetails.MTDtls_DestLocOID = oMTDetails.MTDtls_DestLocOID;
                        oInvMTDetails.MTDtls_DesInvtyp  = oMTDetails.MTDtls_DesInvtyp;

                        if (dgItemList.Rows[i].Cells["colFinalQty"].Value != null)
                        {
                            oInvMTDetails.MTDtls_IssQty = float.Parse(((DataGridViewTextBoxCell)dgItemList.Rows[i].Cells["colFinalQty"]).Value.ToString());
                        }
                        else
                        {
                            oInvMTDetails.MTDtls_IssQty = 0.00f;
                        }
                        oMTFinalQtyDic.Add(oInvMTDetails.MTDtls_ItemOID, oInvMTDetails);
                    }
                }
                else
                {
                    return(null);
                }
            }

            //for update inv
            foreach (string obj in oMTExistingQtyDic.Keys)
            {
                if (!oMTFinalQtyDic.ContainsKey(obj))
                {
                    CMTDetails oInvMTDetails = new CMTDetails();

                    oInvMTDetails.MTDtls_ItemOID   = oMTExistingQtyDic[obj].MTDtls_ItemOID;
                    oInvMTDetails.MTDtls_Branch    = oMTExistingQtyDic[obj].MTDtls_Branch;
                    oInvMTDetails.MTDtls_SBranOID  = oMTExistingQtyDic[obj].MTDtls_SBranOID;
                    oInvMTDetails.MTDtls_SrcLocOID = oMTExistingQtyDic[obj].MTDtls_SrcLocOID;
                    oInvMTDetails.MTDtls_SrcInvTyp = oMTExistingQtyDic[obj].MTDtls_SrcInvTyp;

                    oInvMTDetails.MTDtls_DBranOID   = oMTExistingQtyDic[obj].MTDtls_DBranOID;
                    oInvMTDetails.MTDtls_DestLocOID = oMTExistingQtyDic[obj].MTDtls_DestLocOID;
                    oInvMTDetails.MTDtls_DesInvtyp  = oMTExistingQtyDic[obj].MTDtls_DesInvtyp;

                    oInvMTDetails.MTDtls_IssQty = oMTExistingQtyDic[obj].MTDtls_IssQty * -1;

                    oMTFinalQtyDic.Add(obj, oInvMTDetails);
                }
            }
            return(oMTMaster);
        }