/// <summary>
        /// Check existing billing office
        /// </summary>
        /// <param name="OfficeCode"></param>
        /// <returns></returns>
        public bool BLS020_ValidExistOffice(string OfficeCode)
        {
            if (CommonUtil.IsNullOrEmpty(OfficeCode) == false)
            {
                IOfficeMasterHandler handler = ServiceContainer.GetService <IOfficeMasterHandler>() as IOfficeMasterHandler;
                // Get all office data
                List <tbm_Office> list = handler.GetTbm_Office();
                var lstheadOffice      = (from p in list
                                          where p.OfficeLevel == InventoryHeadOffice.C_OFFICELEVEL_HEAD
                                          select p.OfficeCode).ToList <string>();


                var bHasHeadOffice = (from p in CommonUtil.dsTransData.dtOfficeData
                                      where lstheadOffice.Contains(p.OfficeCode)
                                      select p
                                      ).Count() > 0;

                var existsBillingOffice = CommonUtil.dsTransData.dtUserBelongingData.Where(x => x.OfficeCode == OfficeCode);

                if (!bHasHeadOffice && existsBillingOffice.Count() <= 0)
                {
                    return(false);
                }
                else // Head Office can to access all billing target
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 2
0
        /// <summary>
        ///ACS010_Search
        /// </summary>
        /// <param name="searchCondition"></param>
        /// <returns></returns>
        public ActionResult ACS010_Search(ACS010_Search searchCondition)
        {
            CommonUtil       c   = new CommonUtil();
            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            List <dtAccountingDocumentList> list = new List <dtAccountingDocumentList>();

            AccountingHandler handler = new AccountingHandler();

            IOfficeMasterHandler officehandler = ServiceContainer.GetService <IOfficeMasterHandler>() as IOfficeMasterHandler;

            try
            {
                var officeItem = officehandler.GetTbm_Office(CommonUtil.dsTransData.dtUserData.MainOfficeCode);
                list = handler.GetAccountingDocumentList(searchCondition, officeItem[0].HQCode);
            }
            catch (Exception ex)
            {
                list            = new List <dtAccountingDocumentList>();
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }
            res.ResultData = CommonUtil.ConvertToXml <dtAccountingDocumentList>(list, "Accounting\\ACS010", CommonUtil.GRID_EMPTY_TYPE.SEARCH);

            return(Json(res));
        }
Esempio n. 3
0
        /// <summary>
        /// Generate operation offfice combobox for screen QUS010
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="id"></param>
        /// <param name="attribute"></param>
        /// <param name="firstElement"></param>
        /// <returns></returns>
        public static MvcHtmlString OperationOfficeComboQUS010(this HtmlHelper helper, string id, object attribute = null, string firstElement = null)
        {
            IOfficeMasterHandler hand      = ServiceContainer.GetService <IOfficeMasterHandler>() as IOfficeMasterHandler;
            List <dtOffice>      lstOffice = hand.GetFunctionSecurity(FunctionSecurity.C_FUNC_SECURITY_NO);
            List <View_dtOffice> lst_view  = CommonUtil.ConvertObjectbyLanguage <dtOffice, View_dtOffice>(lstOffice, "OfficeName");

            return(CommonUtil.CommonComboBoxWithCustomFirstElement <View_dtOffice>(id, lst_view, "ValueCodeDisplay", "OfficeCode", firstElement, attribute));
        }
Esempio n. 4
0
        /// <summary>
        /// Generate operation office combobox for screen QUS010
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="id"></param>
        /// <param name="strServiceTypeCode"></param>
        /// <param name="attribute"></param>
        /// <returns></returns>
        public static MvcHtmlString QuotationOfficeComboQUS010(this HtmlHelper helper, string id, object attribute = null)
        {
            IOfficeMasterHandler hand      = ServiceContainer.GetService <IOfficeMasterHandler>() as IOfficeMasterHandler;
            List <dtOffice>      lstOffice = hand.GetFunctionQuatation(FunctionQuotation.C_FUNC_QUOTATION_NO);
            List <View_dtOffice> lst_view  = CommonUtil.ConvertObjectbyLanguage <dtOffice, View_dtOffice>(lstOffice, "OfficeName");

            return(CommonUtil.CommonComboBox <View_dtOffice>(id, lst_view, "ValueCodeDisplay", "OfficeCode", attribute));
        }
        /// <summary>
        /// Get billing office with special condition
        /// </summary>
        /// <returns></returns>
        public string BillingOfficeWithSpecialCondition()
        {
            List <tbm_Office> list = new List <tbm_Office>();

            try
            {
                IOfficeMasterHandler handler = ServiceContainer.GetService <IOfficeMasterHandler>() as IOfficeMasterHandler;
                // Get all office data
                list = handler.GetTbm_Office();
                List <tbm_Office> headOffice = (from p in list
                                                where p.OfficeCode == CommonUtil.dsTransData.dtUserData.MainOfficeCode
                                                select p).ToList <tbm_Office>();

                if (headOffice.Count > 0)
                {
                    //headOffice[0].OfficeLevel ==

                    // Comment by : Jirawat Jannet : 2016-08-16
                    //if (headOffice[0].OfficeLevel == InventoryHeadOffice.C_OFFICELEVEL_HEAD) // if yes --> Authen cbo
                    //{
                    //    // Filter ==> BillingOfficeNormalCbo where ==> FunctionBilling <> C_FUNC_BILLING_NO
                    //    //list = (from p in list where p.FunctionBilling != FunctionBilling.C_FUNC_BILLING_NO select p).ToList<tbm_Office>();
                    //    return string.Empty;
                    //}
                    //else
                    //{
                    //    // list = headOffice;
                    //    return headOffice[0].OfficeCode;
                    //}
                    return(headOffice[0].OfficeCode);
                }
                else
                {
                    list = new List <tbm_Office>();
                    return(string.Empty);
                }

                // Language mappping
                //CommonUtil.MappingObjectLanguage<tbm_Office>(list);
            }
            catch
            {
                list = new List <tbm_Office>();
                return(string.Empty);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Generate billing office with special condition combobox
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="id"></param>
        /// <param name="attribute"></param>
        /// <param name="include_idx0"></param>
        /// <returns></returns>

        public static MvcHtmlString BillingOfficeWithSpecialConditionCbo(this HtmlHelper helper, string id, object attribute = null, bool include_idx0 = true)
        {
            List <tbm_Office> list = new List <tbm_Office>();

            try
            {
                IOfficeMasterHandler handler = ServiceContainer.GetService <IOfficeMasterHandler>() as IOfficeMasterHandler;
                // Get all office data
                list = handler.GetTbm_Office();
                var lstheadOffice = (from p in list
                                     where p.OfficeLevel == InventoryHeadOffice.C_OFFICELEVEL_HEAD
                                     select p.OfficeCode).ToList <string>();


                var bHasHeadOffice = (from p in CommonUtil.dsTransData.dtOfficeData
                                      where lstheadOffice.Contains(p.OfficeCode)
                                      select p
                                      ).Count() > 0;

                if (bHasHeadOffice)
                {
                    list = (from p in list
                            where p.FunctionBilling == FunctionBilling.C_FUNC_BILLING_YES
                            select p).ToList <tbm_Office>();
                }
                else
                {
                    var lstBelonging = (from p in CommonUtil.dsTransData.dtUserBelongingData
                                        select p.OfficeCode
                                        ).ToList <string>();

                    list = (from p in list
                            where lstBelonging.Contains(p.OfficeCode) && p.FunctionBilling == FunctionBilling.C_FUNC_BILLING_YES
                            select p).ToList <tbm_Office>();
                }
                // Language mappping
                CommonUtil.MappingObjectLanguage <tbm_Office>(list);
            }
            catch
            {
                list = new List <tbm_Office>();
            }

            return(CommonUtil.CommonComboBox <tbm_Office>(id, list, "OfficeDisplay", "OfficeCode", attribute, false));
        }
Esempio n. 7
0
        // Add by Natthavat S. 03/11/2011
        /// <summary>
        /// Generate contract office combobox
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="id"></param>
        /// <param name="attribute"></param>
        /// <returns></returns>
        public static MvcHtmlString ContractOfficeCombo(this HtmlHelper helper, string id, object attribute = null)
        {
            IOfficeMasterHandler officehandler = ServiceContainer.GetService <IOfficeMasterHandler>() as IOfficeMasterHandler;
            var allOffice = officehandler.GetFunctionSale(FunctionSale.C_FUNC_SALE_NO);
            var rawResult = from a in allOffice
                            select new OfficeDataDo
            {
                OfficeCode   = a.OfficeCode,
                OfficeName   = String.Empty,
                OfficeNameEN = a.OfficeNameEN,
                OfficeNameJP = a.OfficeNameJP,
                OfficeNameLC = a.OfficeNameLC
            };

            var result = CommonUtil.ConvertObjectbyLanguage <OfficeDataDo, OfficeDataDo>(rawResult.ToList(), "OfficeName");

            return(CommonUtil.CommonComboBox <OfficeDataDo>(id, result.ToList(), "OfficeCodeName", "OfficeCode", attribute));
        }
Esempio n. 8
0
        public ActionResult ICS101()
        {
            ICS101_ScreenParameter param = GetScreenObject <ICS101_ScreenParameter>();

            List <tbm_Office> list = new List <tbm_Office>();

            if (param != null)
            {
                IOfficeMasterHandler handler = ServiceContainer.GetService <IOfficeMasterHandler>() as IOfficeMasterHandler;

                list = handler.GetTbm_Office();
                list = (from p in list where p.FunctionSecurity != FunctionSecurity.C_FUNC_SECURITY_NO select p).ToList <tbm_Office>();
                CommonUtil.MappingObjectLanguage <tbm_Office>(list);

                ViewBag.chkCollectionAreaList = list.ToArray();
            }

            return(View());
        }
Esempio n. 9
0
        /// <summary>
        /// Get office name by code
        /// </summary>
        /// <param name="ValueCode"></param>
        /// <returns></returns>
        public ActionResult ISS080_GetOfficeNameByCode(string ValueCode)
        {
            ObjectResultData res = new ObjectResultData();

            List <dtOffice> list = new List <dtOffice>();
            string          lang = CommonUtil.GetCurrentLanguage();

            try
            {
                IOfficeMasterHandler OMHandler = ServiceContainer.GetService <IOfficeMasterHandler>() as IOfficeMasterHandler;

                list = OMHandler.GetFunctionLogistic();

                foreach (var item in list)
                {
                    if (ValueCode == item.OfficeCode)
                    {
                        if (CommonUtil.GetCurrentLanguage() == CommonValue.DEFAULT_LANGUAGE_EN)
                        {
                            item.OfficeNameEN = CommonUtil.TextCodeName(item.OfficeCode, item.OfficeNameEN);
                            res.ResultData    = item.OfficeNameEN;
                        }
                        else if (CommonUtil.GetCurrentLanguage() == CommonValue.DEFAULT_LANGUAGE_JP)
                        {
                            item.OfficeNameJP = CommonUtil.TextCodeName(item.OfficeCode, item.OfficeNameJP);
                            res.ResultData    = item.OfficeNameJP;
                        }
                        else
                        {
                            item.OfficeNameLC = CommonUtil.TextCodeName(item.OfficeCode, item.OfficeNameLC);
                            res.ResultData    = item.OfficeNameLC;
                        }
                    }
                }

                return(Json(res));
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
                return(Json(res));
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Generate install slip output target combobox
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="id"></param>
        /// <param name="attribute"></param>
        /// <returns></returns>
        public static MvcHtmlString InstallSlipOutputTargetComboBox(this HtmlHelper helper, string id, object attribute = null)
        {
            List <dtOffice> list = new List <dtOffice>();
            dtOffice        test = new dtOffice();

            string strDisplayName = "OfficeNameEN";

            try
            {
                IOfficeMasterHandler OMHandler = ServiceContainer.GetService <IOfficeMasterHandler>() as IOfficeMasterHandler;

                list = OMHandler.GetFunctionLogistic();

                foreach (var item in list)
                {
                    item.OfficeNameEN = CommonUtil.TextCodeName(item.OfficeCode, item.OfficeNameEN);
                    item.OfficeNameJP = CommonUtil.TextCodeName(item.OfficeCode, item.OfficeNameJP);
                    item.OfficeNameLC = CommonUtil.TextCodeName(item.OfficeCode, item.OfficeNameLC);
                }

                if (CommonUtil.GetCurrentLanguage() == CommonValue.DEFAULT_LANGUAGE_EN)
                {
                    strDisplayName = "OfficeNameEN";
                }
                else if (CommonUtil.GetCurrentLanguage() == CommonValue.DEFAULT_LANGUAGE_JP)
                {
                    strDisplayName = "OfficeNameJP";
                }
                else
                {
                    strDisplayName = "OfficeNameLC";
                }
            }
            catch
            {
                list = new List <dtOffice>();
            }

            return(CommonUtil.CommonComboBox <dtOffice>(id, list, strDisplayName, "OfficeCode", attribute));
        }
Esempio n. 11
0
        /// <summary>
        ///  Refresh office data of dsTrans object
        /// </summary>
        /// <param name="dsTrans"></param>
        public void RefreshOfficeData(dsTransDataModel dsTrans)
        {
            try
            {
                #region Belonging User

                dsTrans.dtUserBelongingData = new List <UserBelongingData>();

                IEmployeeMasterHandler handEmp = ServiceContainer.GetService <IEmployeeMasterHandler>() as IEmployeeMasterHandler;

                List <dtUserBelonging> dtUserBelong = handEmp.getBelongingByEmpNo(dsTrans.dtUserData.EmpNo);
                foreach (dtUserBelonging usrb in dtUserBelong)
                {
                    UserBelongingData UsrBelong = new UserBelongingData(
                        usrb.OfficeCode,
                        usrb.DepartmentCode,
                        usrb.PositionCode);

                    dsTrans.dtUserBelongingData.Add(UsrBelong);
                }

                #endregion
                #region Office

                dsTrans.dtOfficeData = new List <OfficeDataDo>();

                IOfficeMasterHandler handOffice = ServiceContainer.GetService <IOfficeMasterHandler>() as IOfficeMasterHandler;

                List <dtAuthorizeOffice> dtAuthorizedOffice = handOffice.GetAuthorizeOffice(CommonUtil.ConvertToXml_Store <dtUserBelonging>(dtUserBelong));
                dsTrans.dtOfficeData = CommonUtil.ConvertObjectbyLanguage <dtAuthorizeOffice, OfficeDataDo>(dtAuthorizedOffice, "OfficeName");

                #endregion
            }
            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// Retrieve unpaid details debt summary information list of specific screen mode and search criteria information
        /// </summary>
        /// <param name="data">Search criteria</param>
        /// <returns></returns>
        public ActionResult ICS032_SearchData(ICS032_RegisterData data)
        {
            ICS032_ScreenParameter param        = GetScreenObject <ICS032_ScreenParameter>();
            ICS032_RegisterData    RegisterData = new ICS032_RegisterData();
            CommonUtil             comUtil      = new CommonUtil();

            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
            string strMemoBillingTargetCode = string.Empty;
            string strMemoInvoiceNo         = string.Empty;
            int    intMemo = 0;

            try
            {
                // Common Check Sequence

                // System Suspend
                ICommonHandler handlerCommon  = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                IIncomeHandler iincomeHandler = ServiceContainer.GetService <IIncomeHandler>() as IIncomeHandler;

                if (handlerCommon.IsSystemSuspending())
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049);
                    return(Json(res));
                }

                // Check User Permission

                //if (!CheckUserPermission(ScreenID.C_SCREEN_ID_MONEY_COLLECTION_MANAGEMENT_INFO, FunctionID.C_FUNC_ID_OPERATE) )
                //{
                //    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053);
                //    return Json(res);
                //}


                res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

                //Add by budd, support multi-language
                IOfficeMasterHandler masterHandler = ServiceContainer.GetService <IOfficeMasterHandler>() as IOfficeMasterHandler;
                List <tbm_Office>    doTbm_Office  = masterHandler.GetTbm_Office(param.strBillingOfficeCode);

                if (doTbm_Office != null && doTbm_Office.Count > 0)
                {
                    CommonUtil.MappingObjectLanguage <tbm_Office>(doTbm_Office);
                    param.strBillingOfficeName = doTbm_Office[0].OfficeName;
                }



                // load GetBillingCodeDeptSummary
                if (param.doGetUnpaidDetailDebtSummaryByBillingCodeList != null)
                {
                    if (param.doGetUnpaidDetailDebtSummaryByBillingCodeList.Count != 0)
                    {
                        param.doGetBillingCodeDebtSummaryList = iincomeHandler.GetBillingCodeDebtSummaryList(
                            param.doGetUnpaidDetailDebtSummaryByBillingCodeList[0].BillingCode);
                    }
                }
                // load GetDebtTracingMemo
                if (param.doBillingTargetDebtSummaryList != null)
                {
                    if (param.doBillingTargetDebtSummaryList.Count != 0)
                    {
                        strMemoBillingTargetCode = param.doBillingTargetDebtSummaryList[0].BillingTargetCode;
                    }
                }

                if (param.doGetUnpaidInvoiceDebtSummaryByBillingTargetList != null)
                {
                    if (param.doGetUnpaidInvoiceDebtSummaryByBillingTargetList.Count != 0)
                    {
                        strMemoInvoiceNo = param.doGetUnpaidInvoiceDebtSummaryByBillingTargetList[0].InvoiceNo;
                        intMemo          = param.doGetUnpaidInvoiceDebtSummaryByBillingTargetList[0].InvoiceOCC;
                    }
                }


                param.doGetDebtTracingMemoList = iincomeHandler.GetDebtTracingMemoList(
                    strMemoBillingTargetCode,
                    strMemoInvoiceNo,
                    intMemo);

                // return "1" to js is every thing OK
                if (res.MessageList == null || res.MessageList.Count == 0)
                {
                    res.ResultData = param;
                }
                else
                {
                    res.ResultData = null;
                }

                return(Json(res));
            }
            catch (Exception ex)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
Esempio n. 13
0
        public ActionResult CTP060_UpdateEmailContentOfNotifyEmail()
        {
            ObjectResultData        res                  = new ObjectResultData();
            IContractHandler        conHandler           = ServiceContainer.GetService <IContractHandler>() as IContractHandler;
            IRentralContractHandler rentalConHandler     = ServiceContainer.GetService <IRentralContractHandler>() as IRentralContractHandler;
            IMasterHandler          masterHandler        = ServiceContainer.GetService <IMasterHandler>() as IMasterHandler;
            IEmployeeMasterHandler  empMasterHandler     = ServiceContainer.GetService <IEmployeeMasterHandler>() as IEmployeeMasterHandler;
            IBillingMasterHandler   billingmasterhandler = ServiceContainer.GetService <IBillingMasterHandler>() as IBillingMasterHandler;
            IOfficeMasterHandler    officehandler        = ServiceContainer.GetService <IOfficeMasterHandler>() as IOfficeMasterHandler;
            IBillingHandler         billinghandler       = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler;

            List <tbm_Customer>  dtCustomer;
            List <doGetTbm_Site> dtSite;
            List <tbm_Employee>  dtEmployee;
            decimal?contractFeeBeforeChange;
            decimal?ChangeContractFee;

            try
            {
                CommonUtil comUtil = new CommonUtil();
                doNotifyChangeFeeContract doNotifyEmail           = new doNotifyChangeFeeContract();
                List <tbt_ContractEmail>  updateContractEmailList = new List <tbt_ContractEmail>();

                using (TransactionScope scope = new TransactionScope())
                {
                    List <tbt_ContractEmail> contractEmailList = conHandler.GetUnsentNotifyEmail();
                    foreach (tbt_ContractEmail data in contractEmailList)
                    {
                        List <tbt_BillingBasic>  doBillingBasic  = billinghandler.GetTbt_BillingBasic(data.ContractCode, "01");
                        List <tbt_BillingTarget> doBillingTarget = billinghandler.GetTbt_BillingTarget(doBillingBasic[0].BillingTargetCode, null, null);

                        dsRentalContractData dsRentalContract = rentalConHandler.GetEntireContract(data.ContractCode, data.OCC);
                        if (dsRentalContract.dtTbt_RentalSecurityBasic[0].ReturnToOriginalFeeDate != null)
                        {
                            var operationOfficeDat = officehandler.GetTbm_Office(dsRentalContract.dtTbt_RentalContractBasic[0].OperationOfficeCode);
                            var billingOfficeDat   = officehandler.GetTbm_Office(doBillingTarget[0].BillingOfficeCode);

                            EmailTemplateUtil mailUtil = new EmailTemplateUtil(EmailTemplateName.C_EMAIL_TEMPLATE_NAME_CHANGE_FEE);
                            dtCustomer = masterHandler.GetTbm_Customer(dsRentalContract.dtTbt_RentalContractBasic[0].ContractTargetCustCode);
                            dtSite     = masterHandler.GetTbm_Site(dsRentalContract.dtTbt_RentalContractBasic[0].SiteCode);
                            dtEmployee = empMasterHandler.GetTbm_Employee(data.CreateBy);
                            contractFeeBeforeChange = rentalConHandler.GetContractFeeBeforeChange(dsRentalContract.dtTbt_RentalContractBasic[0].ContractCode, dsRentalContract.dtTbt_RentalSecurityBasic[0].OCC, dsRentalContract);

                            doNotifyEmail.ContractCode            = comUtil.ConvertContractCode(dsRentalContract.dtTbt_RentalContractBasic[0].ContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT);
                            doNotifyEmail.ContractTargetNameEN    = dtCustomer[0].CustFullNameEN;
                            doNotifyEmail.ContractTargetNameLC    = dtCustomer[0].CustFullNameLC;
                            doNotifyEmail.SiteNameEN              = dtSite[0].SiteNameEN;
                            doNotifyEmail.SiteNameLC              = dtSite[0].SiteNameLC;
                            doNotifyEmail.ChangeDateOfContractFee = CommonUtil.TextDate(dsRentalContract.dtTbt_RentalSecurityBasic[0].ChangeImplementDate);
                            doNotifyEmail.ContractFeeBeforeChange = CommonUtil.TextNumeric(contractFeeBeforeChange);

                            if (dsRentalContract.dtTbt_RentalContractBasic[0].ContractStatus == ContractStatus.C_CONTRACT_STATUS_STOPPING)
                            {
                                ChangeContractFee = dsRentalContract.dtTbt_RentalSecurityBasic[0].ContractFeeOnStop;
                            }
                            else
                            {
                                ChangeContractFee = dsRentalContract.dtTbt_RentalSecurityBasic[0].OrderContractFee;
                            }

                            doNotifyEmail.ContractFeeAfterChange  = CommonUtil.TextNumeric(ChangeContractFee);
                            doNotifyEmail.ReturnToOriginalFeeDate = CommonUtil.TextDate(dsRentalContract.dtTbt_RentalSecurityBasic[0].ReturnToOriginalFeeDate);
                            doNotifyEmail.OperationOfficeEN       = operationOfficeDat[0].OfficeNameEN;
                            doNotifyEmail.OperationOfficeLC       = operationOfficeDat[0].OfficeNameLC;
                            doNotifyEmail.RegisterChangeEmpNameEN = dtEmployee[0].EmpFirstNameEN + ' ' + dtEmployee[0].EmpLastNameEN;
                            doNotifyEmail.RegisterChangeEmpNameLC = dtEmployee[0].EmpFirstNameLC + ' ' + dtEmployee[0].EmpLastNameLC;
                            doNotifyEmail.BillingOfficeEN         = billingOfficeDat[0].OfficeNameEN;
                            doNotifyEmail.BillingOfficeLC         = billingOfficeDat[0].OfficeNameLC;

                            var mailTemplate = mailUtil.LoadTemplate(doNotifyEmail);
                            data.EmailContent = mailTemplate.TemplateContent;

                            tbt_ContractEmail conEmailTemp = CommonUtil.CloneObject <tbt_ContractEmail, tbt_ContractEmail>(data);
                            updateContractEmailList.Add(conEmailTemp);
                        }
                    }

                    if (updateContractEmailList != null && updateContractEmailList.Count > 0)
                    {
                        conHandler.UpdateTbt_ContractEmail(updateContractEmailList);
                    }

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
        /// <summary>
        /// Register pre-elimination.<br />
        /// - Check system suspending.<br />
        /// - Check permission.<br />
        /// - Check quantity.<br />
        /// - Insert inventory slip.<br />
        /// - Update account transfer new/second hand/sample instrument.<br />
        /// - Generate report.
        /// </summary>
        /// <returns></returns>
        public ActionResult IVS060_cmdConfirm()
        {
            ObjectResultData res = new ObjectResultData();

            try
            {       //Check Suspend
                IVS060_ScreenParameter prm = GetScreenObject <IVS060_ScreenParameter>();
                if (prm.lstTransferInstrument == null)
                {
                    prm.lstTransferInstrument = new List <IVS060INST>();
                }
                foreach (IVS060INST i in prm.lstTransferInstrument)
                {
                    i.IsError = false;
                }

                ICommonHandler ComH = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                if (ComH.IsSystemSuspending())
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049);
                    return(Json(res));
                }
                if (!CheckUserPermission(ScreenID.C_INV_SCREEN_ID_TRANSFER_OFFICE, FunctionID.C_FUNC_ID_OPERATE))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053);
                    return(Json(res));
                }

                IInventoryHandler InvH = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                //8.2.1
                foreach (IVS040INST i in prm.lstTransferInstrument)
                {
                    doCheckTransferQty Cond = new doCheckTransferQty();
                    Cond.OfficeCode     = prm.SourceOffice;
                    Cond.LocationCode   = InstrumentLocation.C_INV_LOC_INSTOCK;
                    Cond.AreaCode       = i.AreaCode;
                    Cond.ShelfNo        = i.ShelfNo;
                    Cond.InstrumentCode = i.InstrumentCode;
                    Cond.TransferQty    = i.TransferInstrumentQty;

                    doCheckTransferQtyResult TransferQtyResult = InvH.CheckTransferQty(Cond);
                    i.InstrumentQty = TransferQtyResult.CurrentyQty;

                    if (TransferQtyResult.OverQtyFlag == null)
                    {
                        res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4009, new string[] { i.InstrumentCode }, new string[] { i.TransQtyID });
                        res.ResultData = prm.lstTransferInstrument;
                        i.IsError      = true;
                        return(Json(res));
                    }
                    else if (TransferQtyResult.OverQtyFlag == true)
                    {
                        res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4008, new string[] { i.InstrumentCode }, new string[] { i.TransQtyID });
                        res.ResultData = prm.lstTransferInstrument;
                        i.IsError      = true;
                        return(Json(res));
                    }
                }

                string strInventorySlipNo = null;
                using (TransactionScope scope = new TransactionScope())
                {
                    //8.3
                    doRegisterTransferInstrumentData data = new doRegisterTransferInstrumentData();
                    data.SlipId = SlipID.C_INV_SLIPID_TRANSFER_OFFICE;
                    IOfficeMasterHandler OffH         = ServiceContainer.GetService <IOfficeMasterHandler>() as IOfficeMasterHandler;
                    bool   blnInventoryHeadOfficeFlag = OffH.CheckInventoryHeadOffice(prm.DestinationOffice);
                    string strDestinationShelfNo      = "";
                    if (blnInventoryHeadOfficeFlag)
                    {
                        strDestinationShelfNo = ShelfNo.C_INV_SHELF_NO_NOT_MOVE_SHELF;
                    }
                    else
                    {
                        strDestinationShelfNo = ShelfNo.C_INV_SHELF_NO_OTHER_LOCATION;
                    }

                    data.InventorySlip = new tbt_InventorySlip();
                    tbt_InventorySlip InvSlip = new tbt_InventorySlip();
                    InvSlip.SlipNo                  = null;
                    InvSlip.SlipStatus              = InventorySlipStatus.C_INV_SLIP_STATUS_TRANSFER;
                    InvSlip.TransferTypeCode        = TransferType.C_INV_TRANSFERTYPE_TRANSFER_OFFICE;
                    InvSlip.InstallationSlipNo      = null;
                    InvSlip.ProjectCode             = null;
                    InvSlip.PurchaseOrderNo         = null;
                    InvSlip.ContractCode            = null;
                    InvSlip.SlipIssueDate           = DateTime.Now;
                    InvSlip.StockInDate             = null;
                    InvSlip.StockOutDate            = DateTime.Now;
                    InvSlip.SourceLocationCode      = InstrumentLocation.C_INV_LOC_INSTOCK;
                    InvSlip.DestinationLocationCode = InstrumentLocation.C_INV_LOC_INSTOCK;
                    InvSlip.SourceOfficeCode        = prm.SourceOffice;
                    InvSlip.DestinationOfficeCode   = prm.DestinationOffice;
                    InvSlip.ApproveNo               = null;
                    InvSlip.Memo                     = prm.Memo;
                    InvSlip.StockInFlag              = null;
                    InvSlip.DeliveryOrderNo          = null;
                    InvSlip.ShelfType                = ShelfType.C_INV_SHELF_TYPE_NORMAL;
                    InvSlip.RepairSubcontractor      = null;
                    InvSlip.InstallationCompleteFlag = null;
                    InvSlip.ContractStartServiceFlag = null;
                    InvSlip.CustomerAcceptanceFlag   = null;
                    //InvSlip.ProjectCompleteFlag=null;
                    InvSlip.PickingListNo = null;
                    InvSlip.CreateBy      = CommonUtil.dsTransData.dtUserData.EmpNo;
                    InvSlip.CreateDate    = CommonUtil.dsTransData.dtOperationData.ProcessDateTime;
                    InvSlip.UpdateDate    = CommonUtil.dsTransData.dtOperationData.ProcessDateTime;
                    InvSlip.UpdateBy      = CommonUtil.dsTransData.dtUserData.EmpNo;
                    data.InventorySlip    = InvSlip;

                    data.lstTbt_InventorySlipDetail = new List <tbt_InventorySlipDetail>();
                    int iRunNo = 1;
                    foreach (IVS040INST i in prm.lstTransferInstrument)
                    {
                        tbt_InventorySlipDetail SlipDetail = new tbt_InventorySlipDetail();
                        SlipDetail.SlipNo              = null;
                        SlipDetail.RunningNo           = iRunNo;
                        SlipDetail.InstrumentCode      = i.InstrumentCode;
                        SlipDetail.SourceAreaCode      = i.AreaCode;
                        SlipDetail.DestinationAreaCode = i.AreaCode;
                        SlipDetail.SourceShelfNo       = i.ShelfNo;
                        SlipDetail.DestinationShelfNo  = strDestinationShelfNo;
                        SlipDetail.TransferQty         = i.TransferInstrumentQty;
                        SlipDetail.NotInstalledQty     = null;
                        SlipDetail.RemovedQty          = null;
                        SlipDetail.UnremovableQty      = null;
                        SlipDetail.InstrumentAmount    = null;

                        data.lstTbt_InventorySlipDetail.Add(SlipDetail);
                        iRunNo++;
                    }
                    strInventorySlipNo = InvH.RegisterTransferInstrument(data);
                    if (InvH.CheckNewInstrument(strInventorySlipNo) == 1)
                    {
                        //8.5.1
                        List <doGroupNewInstrument> groupNewInstrument = InvH.GetGroupNewInstrument(strInventorySlipNo);
                        foreach (doGroupNewInstrument i in groupNewInstrument)
                        {
                            i.DestinationLocationCode = InstrumentLocation.C_INV_LOC_TRANSFER;
                            #region Monthly Price @ 2015
                            //decimal decMovingAveragePrice = InvH.CalculateMovingAveragePrice(i);
                            var decMovingAveragePrice = InvH.GetMonthlyAveragePrice(i.Instrumentcode, InvSlip.SlipIssueDate, InventoryAccountCode.C_INV_ACCOUNT_CODE_INSTOCK, SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_LOCAL, SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US);
                            #endregion
                            InvH.UpdateAccountTransferNewInstrument(i, null);
                        }
                    }

                    //8.6
                    int blnCheckSecondhandInstrument = InvH.CheckSecondhandInstrument(strInventorySlipNo);
                    if (blnCheckSecondhandInstrument == 1)
                    {
                        List <doGroupSecondhandInstrument> GroupSecondHandInstrument = InvH.GetGroupSecondhandInstrument(strInventorySlipNo);
                        foreach (doGroupSecondhandInstrument i in GroupSecondHandInstrument)
                        {
                            i.DestinationLocationCode = InstrumentLocation.C_INV_LOC_TRANSFER;
                            InvH.UpdateAccountTransferSecondhandInstrument(i);
                        }
                    }

                    //8.7
                    int blnCheckSampleInstrument = InvH.CheckSampleInstrument(strInventorySlipNo);
                    if (blnCheckSampleInstrument == 1)
                    {
                        List <doGroupSampleInstrument> GroupSampleInstrument = InvH.GetGroupSampleInstrument(strInventorySlipNo);
                        foreach (doGroupSampleInstrument i in GroupSampleInstrument)
                        {
                            i.DestinationLocationCode = InstrumentLocation.C_INV_LOC_TRANSFER;
                            InvH.UpdateAccountTransferSampleInstrument(i, null);
                        }
                    }

                    scope.Complete();
                } //end transaction scope

                //8.8
                IInventoryDocumentHandler handlerInventoryDocument = ServiceContainer.GetService <IInventoryDocumentHandler>() as IInventoryDocumentHandler;
                string reportPath = handlerInventoryDocument.GenerateIVR040FilePath(strInventorySlipNo, CommonUtil.dsTransData.dtUserData.EmpNo, CommonUtil.dsTransData.dtOperationData.ProcessDateTime);
                prm.slipNo         = strInventorySlipNo;
                prm.reportFilePath = reportPath;
                UpdateScreenObject(prm);

                res.ResultData = strInventorySlipNo;

                return(Json(res));
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex); return(Json(res));
            }
        }
Esempio n. 15
0
        public ActionResult ACS010_GenerateReport(ACS010_Generate generateCondition)
        {
            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
            List <dtAccountingDocumentList> documentList = new List <dtAccountingDocumentList>();

            try
            {
                List <tbm_Office>    list          = new List <tbm_Office>();
                AccountingHandler    handler       = new AccountingHandler();
                IOfficeMasterHandler officehandler = ServiceContainer.GetService <IOfficeMasterHandler>() as IOfficeMasterHandler;
                var officeItem = officehandler.GetTbm_Office(CommonUtil.dsTransData.dtUserData.MainOfficeCode);

                List <dtAccountingDocument> documents = handler.GetAccountingDocument(generateCondition.documentCode);

                //Generate
                DocumentContext context = new DocumentContext();
                context.DocumentCode          = documents[0].DocumentCode;
                context.DocumentGeneratorName = documents[0].DocumentGeneratorName;
                context.UserID = CommonUtil.dsTransData.dtUserData.EmpNo;
                context.DocumentTimingTypeDesc = documents[0].DocumentTimingTypeDesc;
                context.GenerateDate           = DateTime.Now;
                context.TargetPeriodFrom       = generateCondition.generateTargetFrom;
                context.TargetPeriodTo         = generateCondition.generateTargetTo;
                context.UserHQCode             = officeItem[0].HQCode;
                doGenerateDocumentResult result = DocumentGenerator.Generate(context);
                //Success
                if (result.ErrorFlag == false)
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION_OK;

                    res.AddErrorMessage(MessageUtil.MODULE_ACCOUNTING,
                                        ScreenID.C_SCREEN_ID_OTHER_ACCOUNTING_REPORT,
                                        MessageUtil.MODULE_ACCOUNTING,
                                        MessageUtil.MessageList.MSG8004,
                                        null,
                                        new string[] { "AccountingGenerateDocument" });

                    //Result list

                    ACS010_Search searchCondition = new ACS010_Search();

                    searchCondition.SearchDocumentCode = result.DocumentContext.DocumentCode;
                    searchCondition.SearchDocumentNo   = result.ResultDocumentNoList;

                    documentList = handler.GetAccountingDocumentList(searchCondition, result.DocumentContext.UserHQCode);
                }
                //Fail
                else
                {
                    res.AddErrorMessage(MessageUtil.MODULE_ACCOUNTING,
                                        ScreenID.C_SCREEN_ID_OTHER_ACCOUNTING_REPORT,
                                        MessageUtil.MODULE_ACCOUNTING,
                                        result.ErrorCode,
                                        null,
                                        new string[] { "AccountingGenerateDocument" });
                }
            }
            catch (Exception ex)
            {
                documentList    = new List <dtAccountingDocumentList>();
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }
            res.ResultData = CommonUtil.ConvertToXml <dtAccountingDocumentList>(documentList, "Accounting\\ACS010", CommonUtil.GRID_EMPTY_TYPE.SEARCH);

            return(Json(res));
        }
Esempio n. 16
0
        /// <summary>
        /// CSV Gen File by Common CallDownloadController and call download popup screen
        /// </summary>
        /// <returns></returns>
        public void ICS101_ExportCSV()
        {
            ICS101_ScreenParameter param        = GetScreenObject <ICS101_ScreenParameter>();
            ICS101_RegisterData    RegisterData = new ICS101_RegisterData();

            CommonUtil           comUtil = new CommonUtil();
            IOfficeMasterHandler iOfficeMasterHandler = ServiceContainer.GetService <IOfficeMasterHandler>() as IOfficeMasterHandler;

            List <tbm_Office> _dotbm_Office = new List <tbm_Office>();

            // reuse param that send on Register Click
            if (param != null)
            {
                RegisterData = param.RegisterData;
            }

            StringBuilder sbDateFromToData        = new StringBuilder();
            StringBuilder sbCollectionAreaHeader  = new StringBuilder();
            StringBuilder sbCollectionAreaDetails = new StringBuilder();

            sbDateFromToData = CSVAddNewColumn(sbDateFromToData, "Expected Collect Date");
            sbDateFromToData = CSVAddNewColumn(sbDateFromToData, CommonUtil.TextDate(RegisterData.Header.dtpExpectedCollectDateFrom));
            sbDateFromToData = CSVAddNewColumn(sbDateFromToData, "to");
            sbDateFromToData = CSVAddNewColumn(sbDateFromToData, CommonUtil.TextDate(RegisterData.Header.dtpExpectedCollectDateTo));

            sbCollectionAreaHeader = CSVAddNewColumn(sbCollectionAreaHeader, "Collection Area");

            if (RegisterData.Header.chklCollectionArea != null)
            {
                foreach (string CollectionArea in RegisterData.Header.chklCollectionArea)
                {
                    _dotbm_Office = iOfficeMasterHandler.GetTbm_Office(CollectionArea);

                    if (_dotbm_Office != null)
                    {
                        if (_dotbm_Office.Count > 0)
                        {
                            sbCollectionAreaDetails = CSVAddNewColumn(sbCollectionAreaDetails, CollectionArea);
                            sbCollectionAreaDetails = CSVAddNewColumn(sbCollectionAreaDetails, _dotbm_Office[0].OfficeNameEN);
                            sbCollectionAreaDetails = CSVAddNewColumn(sbCollectionAreaDetails, _dotbm_Office[0].OfficeNameLC);
                            sbCollectionAreaDetails = CSVAddNewCRLF(sbCollectionAreaDetails);
                        }
                    }
                }
            }

            string strCSVResultData = string.Empty;

            strCSVResultData = String.Format("{0}{1}{2}{3}{4}{5}"
                                             , sbDateFromToData.ToString(), Environment.NewLine
                                             , sbCollectionAreaHeader.ToString(), Environment.NewLine
                                             , sbCollectionAreaDetails.ToString(), Environment.NewLine);

            if (RegisterData.doICS101_CSVGridData != null)
            {
                foreach (var d in RegisterData.doICS101_CSVGridData)
                {
                    try
                    {
                        d.ReceiptAmount = Convert.ToDecimal(d.ReceiptAmount).ToString("0.00");
                    }
                    catch (Exception)
                    {
                    }
                }
            }


            strCSVResultData = strCSVResultData + CSVReportUtil.GenerateCSVData <ICS101_CSVGridData>(RegisterData.doICS101_CSVGridData, true);

            strCSVResultData = String.IsNullOrEmpty(strCSVResultData) ? string.Empty : strCSVResultData.Replace("<br/>", "").Replace("<BR/>", "");

            this.DownloadCSVFile("MoneyCollectionManagementinfo.csv", strCSVResultData);
        }