Esempio n. 1
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));
        }
        /// <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);
        }
        /// <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. 4
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. 5
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());
        }
        /// <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. 7
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));
        }
Esempio n. 8
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. 9
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);
        }