Beispiel #1
0
        /// <summary>
        /// Check suspend, authority and resume of CMS450
        /// </summary>
        /// <param name="param">Screen parameter</param>
        /// <returns></returns>
        public ActionResult CMS450_Authority(CMS450_ScreenParameter param)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                // Check permission
                if (CheckUserPermission(ScreenID.C_SCREEN_ID_VIEW_BILLING_DETAIL, FunctionID.C_FUNC_ID_OPERATE) == false)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053);
                    return(Json(res));
                }

                // is parameter OK ?
                if (CommonUtil.IsNullOrEmpty(param.BillingTargetCode) &&
                    CommonUtil.IsNullOrEmpty(param.ContractCode) &&
                    CommonUtil.IsNullOrEmpty(param.BillingOCC) &&
                    CommonUtil.IsNullOrEmpty(param.InvoiceNo))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0156);
                    return(Json(res));
                }

                // data is exist ?

                CommonUtil          cm                 = new CommonUtil();
                IBillingHandler     handlerBilling     = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler;
                IViewBillingHandler handlerViewBilling = ServiceContainer.GetService <IViewBillingHandler>() as IViewBillingHandler;

                List <dtTbt_BillingTargetForView> listBillingTarget = new List <dtTbt_BillingTargetForView>();
                if (!CommonUtil.IsNullOrEmpty(param.BillingTargetCode))
                {
                    listBillingTarget = handlerBilling.GetTbt_BillingTargetForView(cm.ConvertBillingTargetCode(param.BillingTargetCode, CommonUtil.CONVERT_TYPE.TO_LONG), MiscType.C_CUST_TYPE);

                    if (listBillingTarget.Count <= 0)
                    {
                        res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001);
                        return(Json(res));
                    }
                }
                else if (!CommonUtil.IsNullOrEmpty(param.BillingOCC) && !CommonUtil.IsNullOrEmpty(param.ContractCode))
                {
                    //GetBillingDetailOfBillingCode
                    string strContractCode = cm.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG);
                    List <dtTbt_BillingBasicForView> listBillingBasicForView = handlerBilling.GetTbt_BillingBasicForView(strContractCode, param.BillingOCC);
                    if (listBillingBasicForView.Count <= 0)
                    {
                        res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001);
                        return(Json(res));
                    }
                }
                else if (!CommonUtil.IsNullOrEmpty(param.InvoiceNo))
                {
                    List <dtViewBillingDetailListOfLastInvoiceOCC> listBillingDetailListOfLastInvoiceOCC = handlerViewBilling.GetViewBillingDetailListOfLastInvoiceOCC(param.InvoiceNo, null, null, null, null);
                    if (listBillingDetailListOfLastInvoiceOCC.Count <= 0)
                    {
                        res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001);
                        return(Json(res));
                    }
                }
                else
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0156);
                    return(Json(res));
                }
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }

            return(InitialScreenEnvironment <CMS450_ScreenParameter>("CMS450", param, res));
        }
Beispiel #2
0
        public ActionResult CMS450()
        {
            ObjectResultData       res   = new ObjectResultData();
            CMS450_ScreenParameter param = GetScreenObject <CMS450_ScreenParameter>();
            CommonUtil             cm    = new CommonUtil();

            // Prepare for show section
            ViewBag._ContractCode      = param.ContractCode;
            ViewBag._BillingOCC        = param.BillingOCC;
            ViewBag._BillingTargetCode = param.BillingTargetCode;
            ViewBag._InvoiceNo         = param.InvoiceNo;

            try
            {
                IBillingHandler     handlerBilling     = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler;
                IViewBillingHandler handlerViewBilling = ServiceContainer.GetService <IViewBillingHandler>() as IViewBillingHandler;

                if (!CommonUtil.IsNullOrEmpty(param.BillingTargetCode))
                {
                    List <dtTbt_BillingTargetForView> listBillingTarget = handlerBilling.GetTbt_BillingTargetForView(cm.ConvertBillingTargetCode(param.BillingTargetCode, CommonUtil.CONVERT_TYPE.TO_LONG), MiscType.C_CUST_TYPE);
                    if (listBillingTarget.Count > 0)
                    {
                        ViewBag.txtBillingTargetCode           = listBillingTarget[0].BillingTargetCode_Short;
                        ViewBag.txtBillingClientNameEnglish    = listBillingTarget[0].FullNameEN;
                        ViewBag.txtBillingClientAddressEnglish = listBillingTarget[0].AddressEN;
                        ViewBag.txtBillingClientNameLocal      = listBillingTarget[0].FullNameLC;
                        ViewBag.txtBillingClientAddressLocal   = listBillingTarget[0].AddressLC;
                    }
                }
                else if (!CommonUtil.IsNullOrEmpty(param.BillingOCC) && !CommonUtil.IsNullOrEmpty(param.ContractCode))
                {
                    //GetBillingDetailOfBillingCode
                    string strContractCode = cm.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG);
                    List <dtTbt_BillingBasicForView> listBillingBasicForView = handlerBilling.GetTbt_BillingBasicForView(strContractCode, param.BillingOCC);
                    if (listBillingBasicForView.Count > 0)
                    {
                        ViewBag.txtBillingCode                 = cm.ConvertBillingCode(listBillingBasicForView[0].BillingCode, CommonUtil.CONVERT_TYPE.TO_SHORT);
                        ViewBag.txtBillingOffice               = listBillingBasicForView[0].OfficeName;
                        ViewBag.txtBillingTargetCode           = cm.ConvertBillingTargetCode(listBillingBasicForView[0].BillingTargetCode, CommonUtil.CONVERT_TYPE.TO_SHORT);
                        ViewBag.txtBillingClientNameEnglish    = listBillingBasicForView[0].FullNameEN;
                        ViewBag.txtBillingClientAddressEnglish = listBillingBasicForView[0].AddressEN;
                        ViewBag.txtBillingClientNameLocal      = listBillingBasicForView[0].FullNameLC;
                        ViewBag.txtBillingClientAddressLocal   = listBillingBasicForView[0].AddressLC;
                    }
                }
                else if (!CommonUtil.IsNullOrEmpty(param.InvoiceNo))
                {
                    List <dtViewBillingDetailListOfLastInvoiceOCC> listBillingDetailListOfLastInvoiceOCC = handlerViewBilling.GetViewBillingDetailListOfLastInvoiceOCC(param.InvoiceNo, null, null, null, null);
                    if (listBillingDetailListOfLastInvoiceOCC.Count > 0)
                    {
                        ViewBag.txtInvoiceNo                   = listBillingDetailListOfLastInvoiceOCC[0].InvoiceNo;
                        ViewBag.txtBillingTargetCode           = cm.ConvertBillingTargetCode(listBillingDetailListOfLastInvoiceOCC[0].BillingTargetCode, CommonUtil.CONVERT_TYPE.TO_SHORT);
                        ViewBag.txtBillingClientNameEnglish    = listBillingDetailListOfLastInvoiceOCC[0].FullNameEN;
                        ViewBag.txtBillingClientAddressEnglish = listBillingDetailListOfLastInvoiceOCC[0].AddressEN;
                        ViewBag.txtBillingClientNameLocal      = listBillingDetailListOfLastInvoiceOCC[0].FullNameLC;
                        ViewBag.txtBillingClientAddressLocal   = listBillingDetailListOfLastInvoiceOCC[0].AddressLC;
                    }
                }
                else
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0040);
                    return(Json(res));
                }
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }
            return(View());
        }
Beispiel #3
0
        /// <summary>
        /// Get billing detail list
        /// </summary>
        /// <returns></returns>
        public ActionResult CMS450_ViewBillingDetailList()
        {
            ObjectResultData res = new ObjectResultData();
            List <dtViewBillingDetailList> list = new List <dtViewBillingDetailList>();

            try
            {
                CMS450_ScreenParameter param             = GetScreenObject <CMS450_ScreenParameter>();
                CommonUtil             cm                = new CommonUtil();
                string strContractCode                   = cm.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG);
                IViewBillingHandler   handlerViewBilling = ServiceContainer.GetService <IViewBillingHandler>() as IViewBillingHandler;
                ICommonHandler        comHand            = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                List <doMiscTypeCode> tmpCurrencies      = comHand.GetMiscTypeCodeList(new List <doMiscTypeCode>()
                {
                    new doMiscTypeCode()
                    {
                        FieldName = MiscType.C_CURRENCT,
                        ValueCode = "%"
                    }
                }).ToList();

                if (!CommonUtil.IsNullOrEmpty(param.BillingTargetCode))
                {
                    list = handlerViewBilling.GetViewBillingDetailListByTargetCode(cm.ConvertBillingTargetCode(param.BillingTargetCode, CommonUtil.CONVERT_TYPE.TO_LONG));
                }
                else if (!CommonUtil.IsNullOrEmpty(param.BillingOCC) && !CommonUtil.IsNullOrEmpty(param.ContractCode))
                {
                    list = handlerViewBilling.GetViewBillingDetailList(strContractCode, param.BillingOCC);
                }
                else if (!CommonUtil.IsNullOrEmpty(param.InvoiceNo))
                {
                    List <dtViewBillingDetailListOfLastInvoiceOCC> listBillingDetail = handlerViewBilling.GetViewBillingDetailListOfLastInvoiceOCC(param.InvoiceNo, null, null, null, null);
                    for (int i = 0; i < listBillingDetail.Count(); i++)
                    {
                        listBillingDetail[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies);
                    }
                    if (listBillingDetail.Count > 0)
                    {
                        List <dtViewBillingDetailList> lst = CommonUtil.ClonsObjectList <dtViewBillingDetailListOfLastInvoiceOCC, dtViewBillingDetailList>(listBillingDetail);
                        res.ResultData = CommonUtil.ConvertToXml <dtViewBillingDetailList>(lst, "Common\\CMS450_ViewBillingDetailInformation", CommonUtil.GRID_EMPTY_TYPE.VIEW);
                        return(Json(res));
                    }
                }
                for (int i = 0; i < list.Count(); i++)
                {
                    list[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies);
                }
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }
            // test
            //list.RemoveRange(0, 670);
            res.ResultData = CommonUtil.ConvertToXml <dtViewBillingDetailList>(list, "Common\\CMS450_ViewBillingDetailInformation", CommonUtil.GRID_EMPTY_TYPE.VIEW);
            return(Json(res));
        }
Beispiel #4
0
        /// <summary>
        /// If user input ContractCode or UserCode retrieve contract data from tbt_RentalContractBasic or tbt_SaleBasic.<br />
        /// Else if user input ProjectCode retrieve project data from tbt_Project.<br />
        /// Else if user input InvoiceNo get billing details of last invoice OCC.
        /// </summary>
        /// <param name="ContractCode"></param>
        /// <param name="UserCode"></param>
        /// <param name="InvoiceNo"></param>
        /// <param name="ProjectCode"></param>
        /// <returns></returns>
        public ActionResult CMS020_Retrive(string ContractCode, string UserCode, string InvoiceNo, string ProjectCode)
        {
            CommonUtil       cm   = new CommonUtil();
            dtSearchBarData  data = new dtSearchBarData();
            ObjectResultData res  = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING_DIALOG;

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

            if (CommonUtil.IsNullOrEmpty(ContractCode) == false)
            {
                list.Add(ContractCode);
            }
            if (CommonUtil.IsNullOrEmpty(UserCode) == false)
            {
                list.Add(UserCode);
            }
            if (CommonUtil.IsNullOrEmpty(InvoiceNo) == false)
            {
                list.Add(InvoiceNo);
            }
            if (CommonUtil.IsNullOrEmpty(ProjectCode) == false)
            {
                list.Add(ProjectCode);
            }

            if (list.Count > 1)
            {
                // Input more than one criteria --> Retrun message
                res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0117);
                return(Json(res));
            }
            else if (list.Count == 0)
            {
                res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006);
                return(Json(res));
            }

            try
            {
                // Case goto CMS190
                if (CommonUtil.IsNullOrEmpty(ContractCode) == false || CommonUtil.IsNullOrEmpty(UserCode) == false)
                {
                    dsContractData contractData = new dsContractData();
                    contractData = CMS020_RetrieveContract(ContractCode, UserCode);

                    if (contractData.dtRCB == null && contractData.dtSB == null)
                    {
                        // Return message MSG0102 // This contract code does not exist.
                        res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0133);
                        return(Json(res));
                    }

                    bool isRCBNull = true;
                    if (contractData.dtRCB != null)
                    {
                        if (CommonUtil.IsNullOrEmpty(UserCode) == false && contractData.dtRCB.Count > 1)
                        {
                            res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0157);
                            return(Json(res));
                        }
                        else if (contractData.dtRCB.Count > 0)
                        {
                            data.ContractCode = cm.ConvertContractCode(contractData.dtRCB[0].ContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT);
                            data.ServiceType  = contractData.dtRCB[0].ServiceTypeCode;
                            data.Mode         = "CMS190";

                            isRCBNull = false;
                        }
                    }
                    if (isRCBNull == true)
                    {
                        if (contractData.dtSB != null)
                        {
                            if (contractData.dtSB.Count > 0)
                            {
                                data.ContractCode = cm.ConvertContractCode(contractData.dtSB[0].ContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT);
                                data.ServiceType  = contractData.dtSB[0].ServiceTypeCode;
                                data.Mode         = "CMS190";
                            }
                        }
                    }

                    //if (data.ContractCode != null)
                    //    CommonUtil.dsTransData.dtCommonSearch.ContractCode = data.ContractCode;
                }
                else if (CommonUtil.IsNullOrEmpty(ProjectCode) == false)
                {
                    IProjectHandler    pHandler = ServiceContainer.GetService <IProjectHandler>() as IProjectHandler;
                    List <tbt_Project> lst      = pHandler.GetTbt_Project(ProjectCode);
                    if (lst.Count == 0)
                    {
                        res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0091, new string[] { ProjectCode });
                        return(Json(res));
                    }

                    data.ProjectCode = ProjectCode;
                    data.Mode        = "CTS260";

                    //CommonUtil.dsTransData.dtCommonSearch.ProjectCode = ProjectCode;
                }
                else if (CommonUtil.IsNullOrEmpty(InvoiceNo) == false)
                {
                    IViewBillingHandler bHandler = ServiceContainer.GetService <IViewBillingHandler>() as IViewBillingHandler;
                    List <dtViewBillingDetailListOfLastInvoiceOCC> lst = bHandler.GetViewBillingDetailListOfLastInvoiceOCC(InvoiceNo, null, null, null, null);
                    if (lst.Count == 0)
                    {
                        res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0150, new string[] { InvoiceNo });
                        return(Json(res));
                    }

                    data.InvoiceNo = InvoiceNo;
                    data.Mode      = "CMS450";

                    //CommonUtil.dsTransData.dtCommonSearch.InvoiceNo = InvoiceNo;
                }
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
                return(Json(res));
            }


            return(Json(data));
        }