Exemplo 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));
        }
Exemplo n.º 2
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));
        }