public static doGenerateDocumentResult Generate(DocumentContext context)
        {
            AccountingHandler        handler = new AccountingHandler();
            doGenerateDocumentResult result  = new doGenerateDocumentResult();

            try
            {
                Assembly assembly = Assembly.Load(context.AssemblyName + ", Version=0.0.0.0, PublicKeyToken=null,Culture=neutral");

                Type[] typelist = assembly.GetTypes();
                string s        = "";
                for (int i = 0; i < typelist.Length - 1; i++)
                {
                    s = s + typelist[i].FullName + ",";
                }


                Type type = assembly.GetType(context.TypeName, true);
                IDocumentGenerator generator = (IDocumentGenerator)Activator.CreateInstance(type);
                result = generator.GenerateDocument(context);
                result.DocumentContext = context;

                return(result);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
示例#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));
        }
示例#3
0
        public static MvcHtmlString AccountingReportCombobox(this HtmlHelper helper, string id, object attribute = null, string firstElement = null)
        {
            AccountingHandler hand = new AccountingHandler();
            List <doAccountingDocumentList> lst = hand.getAccountingReportList();

            return(CommonUtil.CommonComboBoxWithCustomFirstElement <doAccountingDocumentList>(id, lst, "DocumentNameENWithCode", "DocumentCode", firstElement, attribute));
        }
示例#4
0
        public ActionResult ACS010_CheckGenerateReqField(ACS010_Generate generateCondition)
        {
            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            try
            {
                AccountingHandler           handler   = new AccountingHandler();
                List <dtAccountingDocument> documents = handler.GetAccountingDocument(generateCondition.documentCode);

                //Validate
                if (documents[0].DocumentTimingType == "D2")
                {
                    if (CommonUtil.IsNullOrEmpty(generateCondition.generateTargetFrom) || CommonUtil.IsNullOrEmpty(generateCondition.generateTargetTo))
                    {
                        res.AddErrorMessage(MessageUtil.MODULE_ACCOUNTING,
                                            ScreenID.C_SCREEN_ID_OTHER_ACCOUNTING_REPORT,
                                            MessageUtil.MODULE_ACCOUNTING,
                                            MessageUtil.MessageList.MSG8001,
                                            new string[] { "lblTargetPeriod" },
                                            new string[] { "GenerateTargetFrom" });
                        return(Json(res));
                    }
                }
                else
                {
                    if (CommonUtil.IsNullOrEmpty(generateCondition.generateTargetTo))
                    {
                        res.AddErrorMessage(MessageUtil.MODULE_ACCOUNTING,
                                            ScreenID.C_SCREEN_ID_OTHER_ACCOUNTING_REPORT,
                                            MessageUtil.MODULE_ACCOUNTING,
                                            MessageUtil.MessageList.MSG8001,
                                            new string[] { "lblTargetPeriod" },
                                            new string[] { "GenerateTargetTo" });
                        return(Json(res));
                    }
                }
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
        public doGenerateDocumentResult GenerateDocument(DocumentContext context)
        {
            AccountingHandler handler = new AccountingHandler();

            return(handler.ACC009_NewOperationRentalReport(context));
        }
        public doGenerateDocumentResult GenerateDocument(DocumentContext context)
        {
            AccountingHandler handler = new AccountingHandler();

            return(handler.ACC008_VATReport(context));
        }
        public doGenerateDocumentResult GenerateDocument(DocumentContext context)
        {
            AccountingHandler handler = new AccountingHandler();

            return(handler.ACC006_PaymentMatchingInfo(context));
        }
示例#8
0
        public ActionResult GetDocumentTimingName(string documentCode)
        {
            AccountingHandler handler = new AccountingHandler();

            return(Json(handler.getDocumentTimingByDocumentCode(documentCode)));
        }
示例#9
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));
        }