コード例 #1
0
        public Object RegisterPrintModel(string parameters)
        {
            ParameterHelper ph     = new ParameterHelper(parameters);
            int             billid = ph.GetParameterValue <int>("billid");

            DBHelper db       = new DBHelper();
            var      bill     = db.First("bill", billid);
            var      employee = db.First("employee", bill.content.Value <int>("employeeid"));
            var      maker    = db.First("employee", bill.content.Value <int>("makerid"));
            var      vendor   = db.First("vendor", bill.content.Value <int>("vendorid"));

            decimal total = bill.content.Value <decimal>("total");

            PrintData pd = new PrintData();

            pd.HeaderField = new List <string>()
            {
                "公司名称",
                "单据编号",
                "单据日期",
                "经手人",
                "供应商名称",
                "供应商联系人",
                "供应商电话",
                "供应商地址",
                "备注",
                "系统日期",
                "系统时间",
                "应付调整金额",
                "应付调整金额大写"
            };

            pd.HeaderValue = new Dictionary <string, string>()
            {
                { "公司名称", PluginContext.Current.Account.CompanyName },
                { "单据编号", bill.content.Value <string>("billcode") },
                { "单据日期", bill.content.Value <string>("billdate") },
                { "经手人", employee.content.Value <string>("name") },
                { "供应商名称", vendor.content.Value <string>("name") },
                { "供应商联系人", vendor.content.Value <string>("linkman") },
                { "供应商电话", vendor.content.Value <string>("linkmobile") },
                { "供应商地址", vendor.content.Value <string>("address") },
                { "备注", bill.content.Value <string>("comment") },
                { "系统日期", DateTime.Now.ToString("yyyy-MM-dd") },
                { "系统时间", DateTime.Now.ToString("yyyy-MM-dd HH:mm") },
                { "应付调整金额", total.ToString("n2") },
                { "应付调整金额大写", MoneyHelper.ConvertSum(total) }
            };

            pd.DetailField = new List <string>();
            pd.DetailValue = new List <Dictionary <string, string> >();

            PrintManager pm      = new PrintManager(PluginContext.Current.Account.ApplicationId);
            int          modelid = pm.RegisterPrintModel(pd);

            return(new { modelid = modelid });
        }
コード例 #2
0
ファイル: FeeBill.cs プロジェクト: windygu/RingsModuleJxc
        public Object RegisterPrintModel(string parameters)
        {
            ParameterHelper ph     = new ParameterHelper(parameters);
            int             billid = ph.GetParameterValue <int>("billid");

            DBHelper db       = new DBHelper();
            var      bill     = db.First("bill", billid);
            var      employee = db.First("employee", bill.content.Value <int>("employeeid"));
            var      maker    = db.First("employee", bill.content.Value <int>("makerid"));
            var      vendor   = db.FirstOrDefault("select * from vendor where id=" + bill.content.Value <int>("vendorid"));
            var      bank     = db.FirstOrDefault("select * from bank where id=" + bill.content.Value <int>("bankid"));

            decimal total = bill.content.Value <decimal>("total");

            PrintData pd = new PrintData();

            pd.HeaderField = new List <string>()
            {
                "公司名称",
                "单据编号",
                "单据日期",
                "经手人",
                "供应商名称",
                "供应商联系人",
                "供应商电话",
                "供应商地址",
                "备注",
                "系统日期",
                "系统时间",
                "付款账户",
                "金额",
                "金额大写"
            };

            pd.HeaderValue = new Dictionary <string, string>()
            {
                { "公司名称", PluginContext.Current.Account.CompanyName },
                { "单据编号", bill.content.Value <string>("billcode") },
                { "单据日期", bill.content.Value <string>("billdate") },
                { "经手人", employee.content.Value <string>("name") },
                { "供应商名称", vendor == null?"":vendor.content.Value <string>("name") },
                { "供应商联系人", vendor == null?"":vendor.content.Value <string>("linkman") },
                { "供应商电话", vendor == null?"":vendor.content.Value <string>("linkmobile") },
                { "供应商地址", vendor == null?"":vendor.content.Value <string>("address") },
                { "备注", bill.content.Value <string>("comment") },
                { "系统日期", DateTime.Now.ToString("yyyy-MM-dd") },
                { "系统时间", DateTime.Now.ToString("yyyy-MM-dd HH:mm") },
                { "付款账户", bank == null?"":bank.content.Value <string>("name") },
                { "金额", total.ToString("n2") },
                { "金额大写", MoneyHelper.ConvertSum(total) }
            };

            pd.DetailField = new List <string>()
            {
                "行号",
                "科目编号",
                "科目名称",
                "金额",
                "备注"
            };

            pd.DetailValue = new List <Dictionary <string, string> >();
            int i = 0;

            foreach (var item in bill.content.Value <JArray>("details").Values <JObject>())
            {
                var feetype = db.First("fee", item.Value <int>("feeid"));

                Dictionary <string, string> detail = new Dictionary <string, string>();
                i++;
                detail.Add("行号", i.ToString());
                detail.Add("科目编号", feetype.content.Value <string>("code"));
                detail.Add("科目名称", feetype.content.Value <string>("name"));
                detail.Add("金额", item.Value <decimal>("total").ToString("n2"));
                detail.Add("备注", item.Value <string>("comment"));
                pd.DetailValue.Add(detail);
            }

            PrintManager pm      = new PrintManager(PluginContext.Current.Account.ApplicationId);
            int          modelid = pm.RegisterPrintModel(pd);

            return(new { modelid = modelid });
        }
コード例 #3
0
        public Object RegisterPrintModel(string parameters)
        {
            ParameterHelper ph     = new ParameterHelper(parameters);
            int             billid = ph.GetParameterValue <int>("billid");

            DBHelper db       = new DBHelper();
            var      bill     = db.First("bill", billid);
            var      employee = db.First("employee", bill.content.Value <int>("employeeid"));
            var      maker    = db.First("employee", bill.content.Value <int>("makerid"));
            var      customer = db.First("customer", bill.content.Value <int>("customerid"));
            var      stock    = db.First("stock", bill.content.Value <int>("stockid"));

            decimal total         = bill.content.Value <JArray>("details").Values <JObject>().Sum(c => c.Value <decimal>("total"));
            decimal taxtotal      = bill.content.Value <JArray>("details").Values <JObject>().Sum(c => c.Value <decimal>("taxtotal"));
            decimal discounttotal = bill.content.Value <JArray>("details").Values <JObject>().Sum(c => c.Value <decimal>("discounttotal"));
            decimal qty           = bill.content.Value <JArray>("details").Values <JObject>().Sum(c => c.Value <decimal>("qty"));

            PrintData pd = new PrintData();

            pd.HeaderField = new List <string>()
            {
                "公司名称",
                "单据编号",
                "单据日期",
                "经手人",
                "制单人",
                "仓库名称",
                "客户名称",
                "客户联系人",
                "客户电话",
                "客户地址",
                "备注",
                "系统日期",
                "系统时间",
                "未税金额",
                "未税金额大写",
                "含税金额",
                "含税金额大写",
                "折后金额",
                "折后金额大写",
                "数量"
            };

            pd.HeaderValue = new Dictionary <string, string>()
            {
                { "公司名称", PluginContext.Current.Account.CompanyName },
                { "单据编号", bill.content.Value <string>("billcode") },
                { "单据日期", bill.content.Value <string>("billdate") },
                { "经手人", employee.content.Value <string>("name") },
                { "制单人", maker.content.Value <string>("name") },
                { "仓库名称", stock.content.Value <string>("name") },
                { "客户名称", customer.content.Value <string>("name") },
                { "客户联系人", customer.content.Value <string>("linkman") },
                { "客户电话", customer.content.Value <string>("linkmobile") },
                { "客户地址", customer.content.Value <string>("address") },
                { "备注", bill.content.Value <string>("comment") },
                { "系统日期", DateTime.Now.ToString("yyyy-MM-dd") },
                { "系统时间", DateTime.Now.ToString("yyyy-MM-dd HH:mm") },
                { "未税金额", total.ToString("n2") },
                { "未税金额大写", MoneyHelper.ConvertSum(total) },
                { "含税金额", taxtotal.ToString("n2") },
                { "含税金额大写", MoneyHelper.ConvertSum(taxtotal) },
                { "折后金额", discounttotal.ToString("n2") },
                { "折后金额大写", MoneyHelper.ConvertSum(discounttotal) },
                { "数量", qty.ToString() }
            };

            pd.DetailField = new List <string>()
            {
                "行号",
                "产品编号",
                "产品名称",
                "规格",
                "型号",
                "产地",
                "计量单位",
                "条码",
                "数量",
                "库存数量",
                "单价",
                "金额",
                "含税单价",
                "含税金额",
                "税率",
                "折后单价",
                "折后金额",
                "折扣率",
                "备注"
            };

            int stockid = stock.content.Value <int>("id");

            pd.DetailValue = new List <Dictionary <string, string> >();
            int i = 0;

            foreach (var item in bill.content.Value <JArray>("details").Values <JObject>())
            {
                var     product    = db.First("product", item.Value <int>("productid"));
                decimal storageqty = decimal.Zero;
                var     storage    = product.content.Value <JObject>("storage");
                if (storage != null)
                {
                    var s = storage.Value <JObject>(stockid.ToString());

                    if (s != null)
                    {
                        storageqty = s.Value <decimal>("qty");
                    }
                }
                Dictionary <string, string> detail = new Dictionary <string, string>();
                i++;
                detail.Add("行号", i.ToString());
                detail.Add("产品编号", product.content.Value <string>("code"));
                detail.Add("产品名称", product.content.Value <string>("name"));
                detail.Add("规格", product.content.Value <string>("standard"));
                detail.Add("型号", product.content.Value <string>("type"));
                detail.Add("产地", product.content.Value <string>("area"));
                detail.Add("计量单位", product.content.Value <string>("unit"));
                detail.Add("条码", product.content.Value <string>("barcode"));
                detail.Add("数量", item.Value <decimal>("qty").ToString());
                detail.Add("库存数量", storageqty.ToString());
                detail.Add("单价", item.Value <decimal>("price").ToString("n2"));
                detail.Add("金额", item.Value <decimal>("total").ToString("n2"));
                detail.Add("含税单价", item.Value <decimal>("taxprice").ToString("n2"));
                detail.Add("含税金额", item.Value <decimal>("taxtotal").ToString("n2"));
                detail.Add("税率", item.Value <decimal>("taxrate").ToString());
                detail.Add("折后单价", item.Value <decimal>("discountprice").ToString("n2"));
                detail.Add("折后金额", item.Value <decimal>("discounttotal").ToString("n2"));
                detail.Add("折扣率", item.Value <decimal>("discountrate").ToString());
                detail.Add("备注", item.Value <string>("comment"));
                pd.DetailValue.Add(detail);
            }

            PrintManager pm      = new PrintManager(PluginContext.Current.Account.ApplicationId);
            int          modelid = pm.RegisterPrintModel(pd);

            return(new { modelid = modelid });
        }
コード例 #4
0
        public Object RegisterPrintModel(string parameters)
        {
            ParameterHelper ph     = new ParameterHelper(parameters);
            int             billid = ph.GetParameterValue <int>("billid");

            DBHelper db       = new DBHelper();
            var      bill     = db.First("bill", billid);
            var      employee = db.First("employee", bill.content.Value <int>("employeeid"));
            var      maker    = db.First("employee", bill.content.Value <int>("makerid"));
            var      vendor   = db.First("vendor", bill.content.Value <int>("vendorid"));

            decimal total = bill.content.Value <decimal>("total");

            PrintData pd = new PrintData();

            pd.HeaderField = new List <string>()
            {
                "公司名称",
                "单据编号",
                "单据日期",
                "经手人",
                "制单人",
                "供应商名称",
                "供应商联系人",
                "供应商电话",
                "供应商地址",
                "备注",
                "系统日期",
                "系统时间",
                "开票金额",
                "开票金额大写"
            };

            pd.HeaderValue = new Dictionary <string, string>()
            {
                { "公司名称", PluginContext.Current.Account.CompanyName },
                { "单据编号", bill.content.Value <string>("billcode") },
                { "单据日期", bill.content.Value <string>("billdate") },
                { "经手人", employee.content.Value <string>("name") },
                { "制单人", maker.content.Value <string>("name") },
                { "供应商名称", vendor.content.Value <string>("name") },
                { "供应商联系人", vendor.content.Value <string>("linkman") },
                { "供应商电话", vendor.content.Value <string>("linkmobile") },
                { "供应商地址", vendor.content.Value <string>("address") },
                { "备注", bill.content.Value <string>("comment") },
                { "系统日期", DateTime.Now.ToString("yyyy-MM-dd") },
                { "系统时间", DateTime.Now.ToString("yyyy-MM-dd HH:mm") },
                { "开票金额", total.ToString("n2") },
                { "开票金额大写", MoneyHelper.ConvertSum(total) }
            };

            pd.DetailField = new List <string>()
            {
                "行号",
                "单据编号",
                "单据名称",
                "开票金额",
                "发票号码",
                "发票类型",
                "备注"
            };


            pd.DetailValue = new List <Dictionary <string, string> >();
            int i = 0;

            foreach (var item in bill.content.Value <JArray>("details").Values <JObject>())
            {
                var    bzbill   = db.First("bill", item.Value <int>("billid"));
                string billname = bzbill.content.Value <string>("billname");
                if (billname == "purchasebill")
                {
                    billname = "采购入库单";
                }
                else if (billname == "purchasebackbill")
                {
                    billname = "采购退货单";
                }

                Dictionary <string, string> detail = new Dictionary <string, string>();
                i++;
                detail.Add("行号", i.ToString());
                detail.Add("单据编号", bzbill.content.Value <string>("billcode"));
                detail.Add("单据名称", billname);
                detail.Add("开票金额", item.Value <decimal>("invoicetotal").ToString("n2"));
                detail.Add("发票号码", item.Value <string>("invoicecode"));
                detail.Add("发票类型", item.Value <string>("invoicetype"));
                detail.Add("备注", item.Value <string>("comment"));
                pd.DetailValue.Add(detail);
            }

            PrintManager pm      = new PrintManager(PluginContext.Current.Account.ApplicationId);
            int          modelid = pm.RegisterPrintModel(pd);

            return(new { modelid = modelid });
        }