From 9f90263a61a997e65edd4dc7206bc22839b13a5e Mon Sep 17 00:00:00 2001 From: maqiao <625215135@qq.com> Date: Thu, 12 Sep 2024 18:01:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E4=E4=B8=AA=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DM_Weight/App.xaml.cs | 2 + DM_Weight/Converter/MachineTypeConverter.cs | 24 + DM_Weight/DM_Weight.csproj | 15 + DM_Weight/Models/AccountTotalQuantity.cs | 19 + DM_Weight/Models/DrugInfo.cs | 12 +- DM_Weight/Models/MachineRecord.cs | 17 +- DM_Weight/Models/OrderInfo.cs | 7 +- DM_Weight/Report/GridReportUtil.cs | 445 +++++++++- DM_Weight/ReportTemp/account_book_order.grf | 640 +++++++++++++++ DM_Weight/ReportTemp/account_book_temp-01.grf | 742 +++++++++++++++++ .../ReportTemp/account_book_temp-022.grf | 769 ++++++++++++++++++ .../ReportTemp/account_book_temp-0223.grf | 538 ++++++++++++ DM_Weight/ReportTemp/return_empty.grf | 424 ++++++++++ .../MachineRecordWindowViewModel.cs | 16 + .../ViewModels/OrderTakeDialogViewModel.cs | 12 +- .../ViewModels/ReturnEmptyDialogViewModel.cs | 33 +- .../ViewModels/ReturnEmptyWindowViewModel.cs | 1 + .../ViewModels/RoleManagerWindowViewModel.cs | 7 + .../SpecialAccountWindowViewModel.cs | 302 +++++++ DM_Weight/Views/Dialog/OrderTakeDialog.xaml | 4 + DM_Weight/Views/Dialog/ReturnEmptyDialog.xaml | 60 +- DM_Weight/Views/MachineRecordWindow.xaml | 18 +- DM_Weight/Views/ReturnEmptyWindow.xaml | 16 +- DM_Weight/Views/SpecialAccountWindow.xaml | 99 +++ DM_Weight/Views/SpecialAccountWindow.xaml.cs | 51 ++ 25 files changed, 4237 insertions(+), 36 deletions(-) create mode 100644 DM_Weight/Models/AccountTotalQuantity.cs create mode 100644 DM_Weight/ReportTemp/account_book_order.grf create mode 100644 DM_Weight/ReportTemp/account_book_temp-01.grf create mode 100644 DM_Weight/ReportTemp/account_book_temp-022.grf create mode 100644 DM_Weight/ReportTemp/account_book_temp-0223.grf create mode 100644 DM_Weight/ReportTemp/return_empty.grf create mode 100644 DM_Weight/ViewModels/SpecialAccountWindowViewModel.cs create mode 100644 DM_Weight/Views/SpecialAccountWindow.xaml create mode 100644 DM_Weight/Views/SpecialAccountWindow.xaml.cs diff --git a/DM_Weight/App.xaml.cs b/DM_Weight/App.xaml.cs index 7ac68ee..b66f96f 100644 --- a/DM_Weight/App.xaml.cs +++ b/DM_Weight/App.xaml.cs @@ -225,6 +225,8 @@ namespace DM_Weight containerRegistry.RegisterForNavigation(); //库存列表导出账册弹窗 containerRegistry.RegisterForNavigation(); + //账册 + containerRegistry.RegisterForNavigation(); #endregion #region 系统设置 diff --git a/DM_Weight/Converter/MachineTypeConverter.cs b/DM_Weight/Converter/MachineTypeConverter.cs index 8cb0729..d8dd9d0 100644 --- a/DM_Weight/Converter/MachineTypeConverter.cs +++ b/DM_Weight/Converter/MachineTypeConverter.cs @@ -73,6 +73,30 @@ namespace DM_Weight.Converter return 100; } } + //“导出处方登记专册” 按钮是否显示 + if (para.Equals("ReportOrderAccount")) + { + if (status == 2) + { + return Visibility.Visible; + } + else + { + return Visibility.Collapsed; + } + } + //“导出回收登记记录” 按钮是否显示 + if (para.Equals("ReportReturnRecord")) + { + if (status == 3) + { + return Visibility.Visible; + } + else + { + return Visibility.Collapsed; + } + } return Visibility.Collapsed; } diff --git a/DM_Weight/DM_Weight.csproj b/DM_Weight/DM_Weight.csproj index 962e012..19bd955 100644 --- a/DM_Weight/DM_Weight.csproj +++ b/DM_Weight/DM_Weight.csproj @@ -101,6 +101,18 @@ Always + + Always + + + Always + + + Always + + + Always + Always @@ -128,6 +140,9 @@ Always + + Always + Always diff --git a/DM_Weight/Models/AccountTotalQuantity.cs b/DM_Weight/Models/AccountTotalQuantity.cs new file mode 100644 index 0000000..996e69e --- /dev/null +++ b/DM_Weight/Models/AccountTotalQuantity.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DM_Weight.Models +{ + /// + /// 逐日消耗专用账册中数量及批号 + /// + public class AccountTotalQuantity + { + //领药数量、发药数量、结存数量 + public string StrTotalQuantity { get; set; } + //数量对应的批号 + public string StrTotalManuNo { get; set; } + } +} diff --git a/DM_Weight/Models/DrugInfo.cs b/DM_Weight/Models/DrugInfo.cs index ac90234..f77fadb 100644 --- a/DM_Weight/Models/DrugInfo.cs +++ b/DM_Weight/Models/DrugInfo.cs @@ -57,11 +57,21 @@ namespace DM_Weight.Models [SugarColumn(ColumnName = "dosage")] public string Dosage { get; set; } /// - /// ��װ��λ + /// ��װ��λ packUnit这个字段不用了,用bigUnit,smallUnit那2个字段 /// [SugarColumn(ColumnName = "pack_unit")] public string PackUnit { get; set; } /// + /// bigUnit大单位是整盒的 + /// + [SugarColumn(ColumnName = "big_unit")] + public string BigUnit { get; set; } + /// + /// smallUnit是拆零单位 + /// + [SugarColumn(ColumnName = "small_unit")] + public string SmallUnit { get; set; } + /// /// �������� /// [SugarColumn(ColumnName = "manufactory")] diff --git a/DM_Weight/Models/MachineRecord.cs b/DM_Weight/Models/MachineRecord.cs index f9cb957..8f41de3 100644 --- a/DM_Weight/Models/MachineRecord.cs +++ b/DM_Weight/Models/MachineRecord.cs @@ -55,6 +55,9 @@ namespace DM_Weight.Models [Navigate(NavigateType.ManyToOne, nameof(Operator))] public UserList User { get; set; } + + [Navigate(NavigateType.ManyToOne, nameof(InvoiceId))] + public OrderInfo orderInfo { get; set; } /// /// 审核人id /// @@ -106,13 +109,13 @@ namespace DM_Weight.Models /// 退药量 /// 默认值: 0 /// - [SugarColumn(ColumnName = "return_quantity1", IsOnlyIgnoreInsert = true)] + [SugarColumn(ColumnName = "return_quantity1")] public int ReturnQuantity1 { get; set; } /// /// 退空瓶量 /// 默认值: 0 /// - [SugarColumn(ColumnName = "return_quantity2", IsOnlyIgnoreInsert = true)] + [SugarColumn(ColumnName = "return_quantity2")] public int ReturnQuantity2 { get; set; } /// /// 取药记录id @@ -153,5 +156,15 @@ namespace DM_Weight.Models /// [SugarColumn(ColumnName = "receiveDept")] public string ReceiveDept { get; set; } + /// + /// 交回人 + /// + [SugarColumn(ColumnName = "returnPerson")] + public string ReturnPerson { get; set; } + /// + /// 接收人 + /// + [SugarColumn(ColumnName = "receivePerson")] + public string ReceivePerson { get; set; } } } diff --git a/DM_Weight/Models/OrderInfo.cs b/DM_Weight/Models/OrderInfo.cs index 02a4c67..eabac86 100644 --- a/DM_Weight/Models/OrderInfo.cs +++ b/DM_Weight/Models/OrderInfo.cs @@ -12,8 +12,9 @@ namespace DM_Weight.Models { /// /// - /// - [SugarColumn(ColumnName = "order_id", IsPrimaryKey = true, IsIdentity = true)] + ///// + //[SugarColumn(ColumnName = "order_id", IsPrimaryKey = true, IsIdentity = true)] + [SugarColumn(ColumnName = "order_id")] public int OrderId { get; set; } /// /// @@ -24,7 +25,7 @@ namespace DM_Weight.Models /// /// /// - [SugarColumn(ColumnName = "order_no")] + [SugarColumn(ColumnName = "order_no", IsPrimaryKey = true, IsIdentity = true)] public string OrderNo { get; set; } /// /// diff --git a/DM_Weight/Report/GridReportUtil.cs b/DM_Weight/Report/GridReportUtil.cs index ed7148b..26fc4aa 100644 --- a/DM_Weight/Report/GridReportUtil.cs +++ b/DM_Weight/Report/GridReportUtil.cs @@ -9,6 +9,9 @@ using System.Threading.Tasks; using DM_Weight.Models; using System.Configuration; using DM_Weight.util; +using System.Data; +using MySqlConnector; +using System.Windows.Markup; namespace DM_Weight.Report { @@ -17,7 +20,7 @@ namespace DM_Weight.Report // 定义Grid++Report报表主对象 public static GridppReport Report = new GridppReport(); - public static string gridConnectionString = ConfigurationManager.AppSettings["gridConnectionString"]; + public static string gridConnectionString = ConfigurationManager.AppSettings["gridConnectionString"]; /** * 打印预览 * tempname: 模板文件名称 @@ -43,7 +46,7 @@ namespace DM_Weight.Report { Report.ParameterByName("machine_id").Value = (ConfigurationManager.AppSettings["machineId"] ?? "DM1"); }); - string machine_id=(ConfigurationManager.AppSettings["machineId"] ?? "DM1"); + string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1"); string SQL = $@"SELECT cl.`row_no` AS drawerNo,cl.`col_no` AS colNo,cl.`quantity` AS quantity,cl.`manu_no` AS manuNo,cl.`eff_date` AS effDate, di.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,di.`manufactory` AS manuFactory,di.`max_stock` AS baseQuantity, cl.`drug_id` AS drugId FROM channel_stock cl INNER JOIN drug_info di ON di.`drug_id` = cl.`drug_id` WHERE cl.`machine_id` = '{machine_id}' AND cl.`drawer_type` = 1 ORDER BY cl.`drug_id`"; @@ -78,13 +81,13 @@ namespace DM_Weight.Report Report.DetailGrid.Recordset.QuerySQL = SQL; Report.PrintPreview(true); } - public static void PrintReportAccountBook(DateTime? startDate, DateTime? endDate,int type,string drug_id) + public static void PrintReportAccountBook(DateTime? startDate, DateTime? endDate, int type, string drug_id) { DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1"); DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1); - string p_machine_id= (ConfigurationManager.AppSettings["machineId"] ?? "DM1"); + string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1"); // 定义Grid++Report报表主对象 - GridppReport Report = new GridppReport(); + GridppReport Report = new GridppReport(); // 加载模板文件 Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "account_book_temp.grf"); string SQL = string.Empty; @@ -106,11 +109,11 @@ namespace DM_Weight.Report dm_machine_record mr LEFT JOIN drug_info di ON mr.`drug_id` = di.`drug_id` LEFT JOIN user_list u1 ON mr.`operator` = u1.`id` LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id` WHERE mr.`machine_id` = '{p_machine_id}' AND mr.`operation_time` > '{p_startDate}' AND mr.`operation_time` < '{p_endDate}' and IF(mr.`type` = 4 AND mr.`quantity` = 0, 99999, mr.`quantity`) <>99999 "; - if(!string.IsNullOrEmpty(drug_id)) + if (!string.IsNullOrEmpty(drug_id)) { - SQL+= " AND mr.drug_id='"+ drug_id+"' "; + SQL += " AND mr.drug_id='" + drug_id + "' "; } - SQL+= " ORDER BY mr.`drug_id`, mr.`operation_time`, mr.`id`) AS T"; + SQL += " ORDER BY mr.`drug_id`, mr.`operation_time`, mr.`id`) AS T"; if (type > 0) { if (type == 1) @@ -127,6 +130,7 @@ namespace DM_Weight.Report } } Report.DetailGrid.Recordset.QuerySQL = SQL; + Report.PrintPreview(true); } @@ -195,9 +199,9 @@ namespace DM_Weight.Report AND dmr.`machine_id` = '{p_machine_id}' AND dmr.`operation_time` > '{p_startDate}' AND dmr.`operation_time` < '{p_endDate}'"; } - + Report.DetailGrid.Recordset.ConnectionString = gridConnectionString; - Report.DetailGrid.Recordset.QuerySQL= SQL; + Report.DetailGrid.Recordset.QuerySQL = SQL; Report.PrintPreview(true); } @@ -215,13 +219,13 @@ namespace DM_Weight.Report GridppReport Report = new GridppReport(); // 加载模板文件 Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//machine_log.grf"); - + // 加载数据 Report.ParameterByName("type").AsInteger = 1; Report.PrintPreview(true); } //交接班记录报表 - public static void PrintChangeShiftsReport(DateTime? startDate,DateTime? endDate) + public static void PrintChangeShiftsReport(DateTime? startDate, DateTime? endDate) { DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1"); DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1); @@ -258,12 +262,425 @@ namespace DM_Weight.Report GridppReport Report = new GridppReport(); // 加载模板文件 Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//machine_log_check.grf"); - Dictionary> records = new Dictionary>(); + Dictionary> records = new Dictionary>(); records.Add("table", data); - string str= JsonConvert.SerializeObject(records); + string str = JsonConvert.SerializeObject(records); Report.LoadDataFromXML(str); // 加载数据 Report.PrintPreview(true); } + /// + /// 导出处方登记专册 + /// + /// + /// + /// + public static void PrintReportOrderAccount(string orderNo, DateTime? startDate, DateTime? endDate) + { + // 定义Grid++Report报表主对象 + GridppReport Report = new GridppReport(); + DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1"); + DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1); + string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1"); + string SQL = string.Empty; + Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(() => + { + Report.ParameterByName("machine_id").Value = (ConfigurationManager.AppSettings["machineId"] ?? "DM1"); + Report.ParameterByName("startDate").Value = startDate ?? DateTime.Now.AddYears(-10); + Report.ParameterByName("endDate").Value = endDate ?? DateTime.Now.AddDays(1); + }); + Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//account_book_order.grf"); + + SQL = $@"SELECT DISTINCT oi.recv_date,oi.p_name,oi.sex,oi.age,oi.id_number,oi.patient_no,oi.disease,dm.manu_no,od.Quantity,oi.doctor_name,oi.order_no,dm.reviewer,dm.operator,ul.user_name operatorName,ul2.user_name reviewerName + ,di.Drug_name,di.Drug_spec,di.big_unit,di.drug_id,dm.receivePerson + from order_info oi inner join order_detail od on oi.order_no=od.Order_No + LEFT JOIN dm_machine_record dm on oi.order_no=dm.invoice_id + inner JOIN drug_info di on od.drug_id=di.drug_id left join user_list ul on dm.operator=ul.id left join user_list ul2 on dm.reviewer=ul2.id WHERE dm.machine_id = '{p_machine_id}' and oi.recv_date>'{p_startDate}' and oi.recv_date<'{p_endDate}'"; + if (!string.IsNullOrEmpty(orderNo)) + { + SQL += $" and oi.order_no='{orderNo}'"; + } + SQL += " order by di.drug_id"; + + Report.DetailGrid.Recordset.ConnectionString = gridConnectionString; + Report.DetailGrid.Recordset.QuerySQL = SQL; + + Report.PrintPreview(true); + } + /// + /// 导出回收登记记录 + /// + /// + /// + /// + public static void PrintReportReturnEmpty(DateTime? startDate, DateTime? endDate) + { + // 定义Grid++Report报表主对象 + GridppReport Report = new GridppReport(); + DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1"); + DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1); + string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1"); + string SQL = string.Empty; + Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(() => + { + Report.ParameterByName("machine_id").Value = (ConfigurationManager.AppSettings["machineId"] ?? "DM1"); + Report.ParameterByName("startDate").Value = startDate ?? DateTime.Now.AddYears(-10); + Report.ParameterByName("endDate").Value = endDate ?? DateTime.Now.AddDays(1); + }); + Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//return_empty.grf"); + + SQL = $@"SELECT di.drug_id, YEAR(dm.operation_time) as dmYear,oi.P_name,oi.dept_name,dm.operation_time,dm.Quantity,dm.manu_no,dm.returnPerson,dm.receivePerson,di.drug_name,di.Drug_spec,di.big_unit,di.manufactory from order_info oi + inner join dm_machine_record dm on oi.order_no=dm.invoice_id + inner join drug_info di on dm.drug_id=di.drug_id + where dm.type=32 and dm.machine_id = '{p_machine_id}' and dm.operation_time>'{p_startDate}' and dm.operation_time<'{p_endDate}'"; + + SQL += " order by dm.operation_time,di.drug_id"; + + Report.DetailGrid.Recordset.ConnectionString = gridConnectionString; + Report.DetailGrid.Recordset.QuerySQL = SQL; + + Report.PrintPreview(true); + } + + /// + /// 逐日消耗专用账册 + /// + /// + /// + /// + public static void PrintReportSpecialAccount(DateTime endDate, string drug_id) + { + //DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1"); + //DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1); + string strDate = endDate.ToString("yyyy-MM"); + string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1"); + // 定义Grid++Report报表主对象 + GridppReport Report = new GridppReport(); + string SQL = string.Empty; + string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1"); + + #region MyRegion + //string strINSql = $@"SELECT GROUP_CONCAT(Manu_No) AS StrTotalManuNo,GROUP_CONCAT(totalInQuantity) AS StrTotalQuantity FROM + //( + //SELECT + // DISTINCT Manu_No ,sum(IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0))) as totalInQuantity + //from dm_machine_record mr + // INNER JOIN drug_info di ON mr.`drug_id` = di.`drug_id` where mr.machine_id='{machine_id}' + // and IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0)) >0 + // and DATE_FORMAT(operation_time,'%Y-%m')= '{strDate}' and type in('1,31,4') + //GROUP BY mr.drug_id,mr.manu_no + //) as t"; + //AccountTotalQuantity InQuantityList = SqlSugarHelper.Db.SqlQueryable(strINSql) + // .Select(it => new AccountTotalQuantity()).First(); + + //string strOutSql = $@"SELECT GROUP_CONCAT(Manu_No) AS StrTotalManuNo,GROUP_CONCAT(TotalOutQuantity) AS StrTotalQuantity FROM + //( + //SELECT + // DISTINCT Manu_No ,SUM(IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0))) AS TotalOutQuantity + //from dm_machine_record mr + // INNER JOIN drug_info di ON mr.`drug_id` = di.`drug_id` where mr.machine_id='{machine_id}' + // and IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0)) >0 + // and DATE_FORMAT(operation_time,'%Y-%m')= '{strDate}' and type in('2,4') + //GROUP BY mr.drug_id,mr.manu_no + //) as t"; + //AccountTotalQuantity OutQuantityList = SqlSugarHelper.Db.SqlQueryable(strOutSql) + // .Select(it => new AccountTotalQuantity()).First(); + + //string strStockSql = $@"SELECT GROUP_CONCAT(Manu_No) AS StrTotalManuNo,GROUP_CONCAT(stock_quantity) AS StrTotalQuantity FROM + // (SELECT a.Manu_No,a.stock_quantity from dm_machine_record a inner join + // (select drug_id,manu_no,max(operation_time) as latest_date,stock_quantity from dm_machine_record + // WHERE DATE_FORMAT(operation_time,'%Y-%m')='{strDate}' and machine_id='{machine_id}' GROUP BY drug_id,manu_no ) b on a.drug_id=b.drug_id and a.manu_no=b.manu_no + // and a.operation_time=b.latest_date and machine_id='{machine_id}' WHERE DATE_FORMAT(operation_time,'%Y-%m')='{strDate}') as t "; + //AccountTotalQuantity StockQuantityList = SqlSugarHelper.Db.SqlQueryable(strStockSql) + // .Select(it => new AccountTotalQuantity()).First(); + //string str1 = "本月领药数量" + ":" + InQuantityList.StrTotalQuantity + " 批号:" + InQuantityList.StrTotalManuNo; + //string str2 = "本月发药数量" + ":" + OutQuantityList.StrTotalQuantity + " 批号:" + OutQuantityList.StrTotalManuNo; + //string str3 = "本月结存数量" + ":" + StockQuantityList.StrTotalQuantity + " 批号:" + StockQuantityList.StrTotalManuNo; + //Report.ControlByName("StaticBox24").AsStaticBox.Text = str1; + //Report.ControlByName("StaticBox26").AsStaticBox.Text = str2; + //Report.ControlByName("StaticBox28").AsStaticBox.Text = str3; + #endregion + + + //Report.DetailGrid.Recordset.ConnectionString = gridConnectionString; + SQL = $@"SELECT mr.drug_id as drugId,'test' InTotal,YEAR(mr.`operation_time`) as DMYear,MONTH(mr.`operation_time`) as DMMonth, + DAY(mr.`operation_time`) as DMDay,manu_no as manuNo,operation_time as operationTime,return_quantity1 as inQuantity,return_quantity2 as outQuantity, + manunoQuantity as stockQuantity,u1.user_name as operatorName,u2.user_name as reviewerName,di.`drug_name` AS `drugName`, + di.`drug_spec` AS `drugSpec`, di.`pack_unit` AS `packUnit`,di.big_unit as bigUnit, di.`dosage` AS `dosage`, di.`manufactory` AS `manufactory` + FROM dm_machine_record mr INNER JOIN DRUG_INFO di ON mr.drug_id=di.drug_id LEFT JOIN user_list u1 ON mr.`operator` = u1.`id`LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id` + WHERE mr.`machine_id` = '{machine_id}' and type=5 and DATE_FORMAT(operation_time,'%Y-%m')='{strDate}' ORDER BY mr.drug_id,operation_time"; + + //Report.DetailGrid.Recordset.QuerySQL = SQL; + + List> tableList = SqlSugarHelper.Db.SqlQueryable(SQL).ToDictionaryList(); + for (int i = 0; i < tableList.Count; i++) + { + LastMonthModel InTotalModel = new LastMonthModel(); + LastMonthModel OutTotalModel = new LastMonthModel(); + LastMonthModel StackTotalModel = new LastMonthModel(); + foreach (KeyValuePair kvp in tableList[i]) + { + if (kvp.Key == "drugId") + { + //查询药品id对应的上月结存数量及批号 + string strValue = kvp.Value.ToString(); + string inQuantitySQL = $@"SELECT GROUP_CONCAT(SumInQuantity) as StrTotalQuantity,GROUP_CONCAT(manu_no) as StrTotalManuNo from + (SELECT sum(return_quantity1) as SumInQuantity,manu_no + from dm_machine_record where drug_id='{strValue}' and machine_id='{machine_id}' and type=5 + and DATE_FORMAT(operation_time,'%Y-%m')='{strDate}'GROUP BY drug_id,manu_no ORDER BY drug_id,operation_time) as t"; + InTotalModel = SqlSugarHelper.Db.SqlQueryable(inQuantitySQL).First(); + + string outQuantitySQL = $@"SELECT GROUP_CONCAT(SumInQuantity) as StrTotalQuantity,GROUP_CONCAT(manu_no) as StrTotalManuNo from + (SELECT sum(return_quantity2) as SumInQuantity ,manu_no + from dm_machine_record where drug_id='{strValue}' and machine_id='{machine_id}' and type=5 + and DATE_FORMAT(operation_time,'%Y-%m')='{strDate}' GROUP BY drug_id,manu_no ORDER BY drug_id,operation_time) as t"; + OutTotalModel = SqlSugarHelper.Db.SqlQueryable(outQuantitySQL).First(); + + string stockQuantitySQL = $@"SELECT GROUP_CONCAT(a.Manu_No) as StrTotalManuNo,GROUP_CONCAT(a.manunoQuantity) as StrTotalQuantity from dm_machine_record a inner join + (select drug_id,manu_no,max(operation_time) as latest_date,stock_quantity from dm_machine_record + WHERE DATE_FORMAT(operation_time,'%Y-%m')='{strDate}' and machine_id='{machine_id}' GROUP BY drug_id,manu_no ) b on a.drug_id=b.drug_id and a.manu_no=b.manu_no + and a.operation_time=b.latest_date and machine_id='{machine_id}' WHERE a.drug_id='{strValue}' and DATE_FORMAT(operation_time,'%Y-%m')='{strDate}'"; + StackTotalModel = SqlSugarHelper.Db.SqlQueryable(stockQuantitySQL).First(); + } + } + tableList[i].Add("inTotal", InTotalModel.StrTotalQuantity); + tableList[i].Add("inTotalManuNo", InTotalModel.StrTotalManuNo); + tableList[i].Add("outTotal", OutTotalModel.StrTotalQuantity); + tableList[i].Add("outTotalManuNo", OutTotalModel.StrTotalManuNo); + tableList[i].Add("stockTotal", StackTotalModel.StrTotalQuantity); + tableList[i].Add("stockTotalManuNO", StackTotalModel.StrTotalManuNo); + } + Dictionary>> records = new Dictionary>>(); + records.Add("table", tableList); + string str = JsonConvert.SerializeObject(records); + // 加载模板文件 + Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "account_book_temp-01.grf"); + Report.LoadDataFromXML(str); + Report.PrintPreview(true); + } + static GridppReport rptMain = new GridppReport(); + static GridppReport rptCustomerList = new GridppReport(); + /// + /// 逐日消耗专用账册2 + /// + /// + /// + /// + public static void PrintReportSpecialAccount2(DateTime endDate, string drug_id) + { + //InsertSubReport("ReportTemp//account_book_temp-022.grf", "2d"); + + //用推模式给子报表提供数据:为子报表定义一个外部的报表对象,以便处理其报表事件 + //用推模式给子报表提供数据: + //rptMain.ControlByName("2d").AsSubReport.Report = rptCustomerList; //子报表部件框的报表对象关联一个外部报表对象,以便响应报表事件 + ////rptCustomerList.DetailGrid.Recordset.ConnectionString = gridConnectionString; //让子报表 rptProductList 用推模式填入报表数据,将程序中取得的数据填入到报表中 + //rptCustomerList.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(CustomerListFetchRecord); //连接报表事件 + //rptMain.PrintPreview(true); + + GridppReport Report = new GridppReport(); + string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1"); + string strDate = endDate.ToString("yyyy-MM"); + + string masterSql = $@" SELECT DISTINCT di.`drug_id` AS `drugId`, YEAR(mr.`operation_time`) as DMYear,MONTH(mr.`operation_time`) as DMMonth, di.`drug_name` AS `drugName`, di.`drug_spec` AS `drugSpec`, + di.big_unit as bigUnit, di.`dosage` AS `dosage`, di.`manufactory` AS `manufactory`, '' lastMonthStock,'' lastMonthMauno, + mr.`manu_no` AS `manuNo`from dm_machine_record mr inner join drug_info di on mr.drug_id=di.drug_id where machine_id='{machine_id}' and type in(1,2,31,4) and DATE_FORMAT(mr.operation_time,'%Y-%m')='{strDate}' + ORDER BY mr.drug_id"; + List> masterList = SqlSugarHelper.Db.SqlQueryable(masterSql).ToDictionaryList(); + + string detail1Sql = $@" SELECT di.drug_id as drugId,DAY(mr.operation_time) AS DMDAY,mr.TYPE, + IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0)) AS `inQuantity`, + mr.manu_no as manuNo,ul.user_name as operatorname,u2.user_name as reviewername from dm_machine_record mr + inner join drug_info di on mr.drug_id=di.drug_id left join user_list ul on mr.operator=ul.id left join user_list u2 on mr.reviewer=u2.id + where mr.machine_id='{machine_id}' and type in (1,31,4) and DATE_FORMAT(mr.operation_time,'%Y-%m')='{strDate}' + and if(mr.Type=4 and mr.Quantity=0,99999, mr.`quantity`) <>99999 ORDER BY mr.drug_id"; + List> detail1List = SqlSugarHelper.Db.SqlQueryable(detail1Sql).ToDictionaryList(); + + string detail2Sql = $@"SELECT + di.`drug_id` AS `drugId`,DAY(mr.`operation_time`) as DMDay, + mr.type, mr.`stock_quantity` AS `stockQuantity`, + -- IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0)) AS `inQuantity`, + IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0)) AS `outQuantity`, + mr.`operation_time` AS `operationTime`,-- IF(mr.`type`=1,mr.`invoice_id`,NULL) AS `invoiceId`, + mr.`manu_no` AS `manuNo`,-- mr.`eff_date` AS `effDate`, + u1.`user_name` AS `operatorName`, u2.`user_name` AS `reviewerName` -- ,mr.supplierDept,mr.receiveDept + -- sum(InQuantity) as TotalInQuantity + FROM + dm_machine_record mr INNER JOIN drug_info di ON mr.`drug_id` = di.`drug_id` LEFT JOIN user_list u1 ON mr.`operator` = u1.`id` + LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id` WHERE mr.`machine_id` = '{machine_id}' AND type in(2,4) + AND DATE_FORMAT(mr.operation_time,'%Y-%m')= '{strDate}' and IF(mr.`type` = 4 AND mr.`quantity` = 0, 99999, mr.`quantity`) <>99999 ORDER BY mr.drug_id "; + + List> detail2List = SqlSugarHelper.Db.SqlQueryable(detail2Sql).ToDictionaryList(); + + Dictionary>> records = new Dictionary>>(); + records.Add("Master", masterList); + records.Add("Detail1", detail1List); + records.Add("Detail2", detail2List); + + string str = JsonConvert.SerializeObject(records); + Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "account_book_temp-022.grf"); + Report.LoadDataFromXML(str); + // 加载数据 + Report.PrintPreview(true); + } + + public static void PrintReportSpecialAccount2New(DateTime MonthDate, string drug_id) + { + GridppReport Report = new GridppReport(); + string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1"); + string strDate = MonthDate.ToString("yyyy-MM"); + int DMYear = MonthDate.Year; + int DMMonth = MonthDate.Month; + string masterSql = $@"SELECT distinct di.drug_id as drugId,di.drug_name as drugName,di.drug_spec as drugSpec,di.big_unit as bigUnit,di.manufactory as manufactory,{DMYear} DMYear,{DMMonth} DMMonth from channel_stock cs + inner join drug_info di on cs.drug_id=di.drug_id where machine_id='{machine_id}' ORDER BY di.drug_id "; + List> masterList = SqlSugarHelper.Db.SqlQueryable(masterSql).ToDictionaryList(); + + + for (int i = 0; i < masterList.Count; i++) + { + LastMonthModel lastMonth = new LastMonthModel(); + foreach (KeyValuePair kvp in masterList[i]) + { + if (kvp.Key == "drugId") + { + //查询药品id对应的上月结存数量及批号 + string strValue = kvp.Value.ToString(); + string lastMonthSql = $@"SELECT GROUP_CONCAT(manu_no) as StrTotalManuNo,GROUP_CONCAT(manunoQuantity) as StrTotalQuantity + from dm_machine_record where drug_id='{strValue}' and machine_id='{machine_id}' and DATE_FORMAT(operation_time,'%Y-%m-%d')=LAST_DAY(DATE_SUB('{MonthDate}', INTERVAL 1 MONTH)) and type=5"; + lastMonth = SqlSugarHelper.Db.SqlQueryable(lastMonthSql).First(); + } + } + masterList[i].Add("lastMonthStock", lastMonth.StrTotalManuNo); + masterList[i].Add("lastMonthMauno", lastMonth.StrTotalQuantity); + } + + + + string detailSql = $@"SELECT drug_id as drugId,DAY(mr.`operation_time`) as DMDay,manu_no as manuNo,operation_time as operationTime,return_quantity1 as inQuantity,return_quantity2 as outQuantity, + manunoQuantity as stockQuantity,u1.user_name as operatorName,u2.user_name as reviewerName + FROM dm_machine_record mr LEFT JOIN user_list u1 ON mr.`operator` = u1.`id`LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id` + WHERE mr.`machine_id` = '{machine_id}' and type=5 and DATE_FORMAT(operation_time,'%Y-%m')='{strDate}' ORDER BY drug_id,operation_time"; + + List> detailMaster0List = SqlSugarHelper.Db.SqlQueryable(detailSql).ToDictionaryList(); + List> detailMaster1List = SqlSugarHelper.Db.SqlQueryable(detailSql).ToDictionaryList(); + + //List> detail1List = detailList.Where(it => Convert.ToInt32(it.GetValueOrDefault("inQuantity")) > 0 && Convert.ToInt32(it.GetValueOrDefault("outQuantity")) <= 0) + List> detail1List = detailMaster0List.Where(it => Convert.ToInt32(it.GetValueOrDefault("inQuantity")) > 0) + .Select(it => + { + it.Remove("outQuantity"); + it.Remove("stockQuantity"); + return it; + }) + .ToList(); + //List> detail2List = detailList.Where(it => Convert.ToInt32(it.GetValueOrDefault("outQuantity")) >0||!(Convert.ToInt32(it.GetValueOrDefault("inQuantity")) >0 && Convert.ToInt32(it.GetValueOrDefault("outQuantity")) == 0)) + List> detail2List = detailMaster1List + .Select(it => + { + it.Remove("inQuantity"); + return it; + }).ToList(); + Dictionary>> records = new Dictionary>>(); + records.Add("Master", masterList); + records.Add("Detail1", detail1List); + records.Add("Detail2", detail2List); + string str = JsonConvert.SerializeObject(records); + Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "account_book_temp-022.grf"); + Report.LoadDataFromXML(str); + // 加载数据 + Report.PrintPreview(true); + + } + public static void test(DateTime endDate, string drug_id) + { + //DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1"); + //DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1); + string strDate = endDate.ToString("yyyy-MM"); + string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1"); + // 定义Grid++Report报表主对象 + GridppReport Report = new GridppReport(); + // 加载模板文件 + Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "account_book_temp-02.grf"); + string SQL = string.Empty; + string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1"); + string strINSql = $@"SELECT GROUP_CONCAT(Manu_No) AS StrTotalManuNo,GROUP_CONCAT(totalInQuantity) AS StrTotalQuantity FROM + ( + SELECT + DISTINCT Manu_No ,sum(IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0))) as totalInQuantity + from dm_machine_record mr + INNER JOIN drug_info di ON mr.`drug_id` = di.`drug_id` where mr.machine_id='{machine_id}' + and IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0)) >0 + and DATE_FORMAT(operation_time,'%Y-%m')= '{strDate}' and type in('1,31,4') + GROUP BY mr.drug_id,mr.manu_no + ) as t"; + AccountTotalQuantity InQuantityList = SqlSugarHelper.Db.SqlQueryable(strINSql) + .Select(it => new AccountTotalQuantity()).First(); + + string strOutSql = $@"SELECT GROUP_CONCAT(Manu_No) AS StrTotalManuNo,GROUP_CONCAT(TotalOutQuantity) AS StrTotalQuantity FROM + ( + SELECT + DISTINCT Manu_No ,SUM(IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0))) AS TotalOutQuantity + from dm_machine_record mr + INNER JOIN drug_info di ON mr.`drug_id` = di.`drug_id` where mr.machine_id='{machine_id}' + and IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0)) >0 + and DATE_FORMAT(operation_time,'%Y-%m')= '{strDate}' and type in('2,4') + GROUP BY mr.drug_id,mr.manu_no + ) as t"; + AccountTotalQuantity OutQuantityList = SqlSugarHelper.Db.SqlQueryable(strOutSql) + .Select(it => new AccountTotalQuantity()).First(); + + string strStockSql = $@"SELECT GROUP_CONCAT(Manu_No) AS StrTotalManuNo,GROUP_CONCAT(stock_quantity) AS StrTotalQuantity FROM + (SELECT a.Manu_No,a.stock_quantity from dm_machine_record a inner join + (select drug_id,manu_no,max(operation_time) as latest_date,stock_quantity from dm_machine_record + WHERE DATE_FORMAT(operation_time,'%Y-%m')='{strDate}' and machine_id='{machine_id}' GROUP BY drug_id,manu_no ) b on a.drug_id=b.drug_id and a.manu_no=b.manu_no + and a.operation_time=b.latest_date and machine_id='{machine_id}' WHERE DATE_FORMAT(operation_time,'%Y-%m')='{strDate}') as t "; + AccountTotalQuantity StockQuantityList = SqlSugarHelper.Db.SqlQueryable(strStockSql) + .Select(it => new AccountTotalQuantity()).First(); + string str1 = "本月领药数量" + ":" + InQuantityList.StrTotalQuantity + " 批号:" + InQuantityList.StrTotalManuNo; + string str2 = "本月发药数量" + ":" + OutQuantityList.StrTotalQuantity + " 批号:" + OutQuantityList.StrTotalManuNo; + string str3 = "本月结存数量" + ":" + StockQuantityList.StrTotalQuantity + " 批号:" + StockQuantityList.StrTotalManuNo; + //Report.ControlByName("StaticBox24").AsStaticBox.Text = str1; + //Report.ControlByName("StaticBox26").AsStaticBox.Text = str2; + //Report.ControlByName("StaticBox28").AsStaticBox.Text = str3; + + + Report.DetailGrid.Recordset.ConnectionString = gridConnectionString; + //Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(() => + //{ + // Report.ParameterByName("machine_id").Value = (ConfigurationManager.AppSettings["machineId"] ?? "DM1"); + // Report.ParameterByName("startDate").Value = startDate ?? Convert.ToDateTime("2010-1-1"); + // Report.ParameterByName("endDate").Value = endDate ?? DateTime.Now.AddDays(1); + //}); + //Report.DetailGrid.Recordset.QuerySQL = SQL; + SQL = $@"SELECT + YEAR(mr.`operation_time`) as DMYear,MONTH(mr.`operation_time`) as DMMonth,DAY(mr.`operation_time`) as DMDay, + mr.type, mr.`stock_quantity` AS `stockQuantity`, + -- IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0)) AS `inQuantity`, + IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0)) AS `outQuantity`, + mr.`operation_time` AS `operationTime`,-- IF(mr.`type`=1,mr.`invoice_id`,NULL) AS `invoiceId`, + di.`drug_name` AS `drugName`, di.`drug_id` AS `drugId`, + di.`drug_spec` AS `drugSpec`, di.`pack_unit` AS `packUnit`,di.big_unit as bigUnit, di.`dosage` AS `dosage`, di.`manufactory` AS `manufactory`, + mr.`manu_no` AS `manuNo`,-- mr.`eff_date` AS `effDate`, + u1.`user_name` AS `operatorName`, u2.`user_name` AS `reviewerName` -- ,mr.supplierDept,mr.receiveDept + -- sum(InQuantity) as TotalInQuantity + FROM + dm_machine_record mr INNER JOIN drug_info di ON mr.`drug_id` = di.`drug_id` LEFT JOIN user_list u1 ON mr.`operator` = u1.`id` + LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id` WHERE mr.`machine_id` = '{machine_id}' AND type in(2,4) + AND DATE_FORMAT(mr.operation_time,'%Y-%m')= '{strDate}' and IF(mr.`type` = 4 AND mr.`quantity` = 0, 99999, mr.`quantity`) <>99999 "; + if (!string.IsNullOrEmpty(drug_id)) + { + SQL += " AND mr.drug_id='" + drug_id + "' "; + } + SQL += "ORDER BY YEAR(mr.`operation_time`),MONTH(mr.`operation_time`),DAY(mr.`operation_time`),mr.`drug_id`,mr.manu_no"; //" GROUP BY mr.drug_id,mr.manu_no,mr.operation_time " + + + Report.DetailGrid.Recordset.QuerySQL = SQL; + + Report.PrintPreview(true); + } + + } + public class LastMonthModel + { + public string StrTotalManuNo { get; set; } = "0"; + public string StrTotalQuantity { get; set; } = "0"; } } diff --git a/DM_Weight/ReportTemp/account_book_order.grf b/DM_Weight/ReportTemp/account_book_order.grf new file mode 100644 index 0000000..df39ff4 --- /dev/null +++ b/DM_Weight/ReportTemp/account_book_order.grf @@ -0,0 +1,640 @@ +{ + "Version":"6.8.1.1", + "Font":{ + "Name":"宋体", + "Size":105000, + "Weight":400, + "Charset":134 + }, + "Printer":{ + "Oriention":"Landscape", + "LeftMargin":1, + "TopMargin":1.42875, + "RightMargin":1, + "BottomMargin":1.8 + }, + "DetailGrid":{ + "CenterView":true, + "Recordset":{ + "Field":[ + { + "Name":"日期", + "Type":"DateTime", + "Format":"yyyy/MM/dd", + "DBFieldName":"recv_date" + }, + { + "Name":"患者姓名", + "DBFieldName":"p_name" + }, + { + "Name":"性别", + "DBFieldName":"sex" + }, + { + "Name":"年龄", + "Type":"Integer", + "DBFieldName":"age" + }, + { + "Name":"身份证号", + "DBFieldName":"id_number" + }, + { + "Name":"病历号", + "Type":"Integer", + "DBFieldName":"patient_no" + }, + { + "Name":"疾病名称", + "DBFieldName":"disease" + }, + { + "Name":"批号", + "DBFieldName":"manu_no" + }, + { + "Name":"数量", + "DBFieldName":"Quantity" + }, + { + "Name":"处方医师", + "DBFieldName":"doctor_name" + }, + { + "Name":"处方号", + "DBFieldName":"order_no" + }, + { + "Name":"发药人", + "DBFieldName":"operatorName" + }, + { + "Name":"复核人", + "DBFieldName":"reviewerName" + }, + { + "Name":"取药人", + "DBFieldName":"receivePerson" + }, + { + "Name":"厂家", + "DBFieldName":"manuFactory" + }, + { + "Name":"有效期", + "Type":"DateTime", + "Format":"yy/M/d", + "DBFieldName":"effDate" + }, + { + "Name":"sign1", + "Type":"Binary" + }, + { + "Name":"sign2", + "Type":"Binary" + }, + { + "Name":"drugId", + "DBFieldName":"drug_id" + }, + { + "Name":"凭证号", + "DBFieldName":"invoiceId" + }, + { + "Name":"药品名称", + "DBFieldName":"Drug_name" + }, + { + "Name":"规格", + "DBFieldName":"Drug_spec" + }, + { + "Name":"单位", + "DBFieldName":"big_unit" + } + ] + }, + "Column":[ + { + "Name":"处方日期", + "Width":1.98438 + }, + { + "Name":"患者姓名", + "Width":1.79917 + }, + { + "Name":"性别", + "Width":1.00542 + }, + { + "Name":"年龄", + "Width":1.00542 + }, + { + "Name":"身份证号", + "Width":3.78354 + }, + { + "Name":"病历号", + "Width":1.79917 + }, + { + "Name":"疾病名称", + "Width":4.20688 + }, + { + "Name":"批号", + "Width":2.01083 + }, + { + "Name":"数量", + "Width":0.846667 + }, + { + "Name":"处方医师", + "Width":1.56104 + }, + { + "Name":"处方号", + "Width":3.175 + }, + { + "Name":"发药人", + "Width":1.40229 + }, + { + "Name":"复核人", + "Width":1.37583 + }, + { + "Name":"取药人(科室)", + "Width":1.61396 + } + ], + "ColumnContent":{ + "Height":0.85, + "ColumnContentCell":[ + { + "Column":"处方日期", + "TextAlign":"MiddleCenter", + "DataField":"日期" + }, + { + "Column":"患者姓名", + "DataField":"患者姓名" + }, + { + "Column":"性别", + "TextAlign":"MiddleCenter", + "DataField":"性别" + }, + { + "Column":"年龄", + "TextAlign":"MiddleCenter", + "DataField":"年龄" + }, + { + "Column":"身份证号", + "TextAlign":"MiddleCenter", + "DataField":"身份证号" + }, + { + "Column":"病历号", + "TextAlign":"MiddleCenter", + "DataField":"病历号" + }, + { + "Column":"疾病名称", + "TextAlign":"MiddleCenter", + "DataField":"疾病名称" + }, + { + "Column":"批号", + "FreeCell":true, + "Control":[ + { + "Type":"FieldBox", + "Name":"FieldBox12", + "Dock":"Fill", + "TextAlign":"MiddleCenter", + "DataField":"批号" + } + ] + }, + { + "Column":"数量", + "FreeCell":true, + "Control":[ + { + "Type":"FieldBox", + "Name":"FieldBox13", + "Dock":"Fill", + "TextAlign":"MiddleCenter", + "DataField":"数量" + } + ] + }, + { + "Column":"处方医师", + "FreeCell":true, + "Control":[ + { + "Type":"FieldBox", + "Name":"FieldBox14", + "Dock":"Fill", + "TextAlign":"MiddleCenter", + "DataField":"处方医师" + } + ] + }, + { + "Column":"处方号", + "FreeCell":true, + "Control":[ + { + "Type":"FieldBox", + "Name":"FieldBox15", + "Dock":"Fill", + "TextAlign":"MiddleCenter", + "DataField":"处方号" + } + ] + }, + { + "Column":"发药人", + "DataField":"发药人" + }, + { + "Column":"复核人", + "DataField":"复核人" + }, + { + "Column":"取药人(科室)", + "DataField":"取药人" + } + ] + }, + "ColumnTitle":{ + "Height":1.19063, + "RepeatStyle":"OnGroupHeaderPage", + "ColumnTitleCell":[ + { + "GroupTitle":false, + "Column":"处方日期", + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"处方日期" + }, + { + "GroupTitle":false, + "Column":"患者姓名", + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"患者姓名" + }, + { + "GroupTitle":false, + "Column":"性别", + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"性\r\n别" + }, + { + "GroupTitle":false, + "Column":"年龄", + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"年\r\n龄" + }, + { + "GroupTitle":false, + "Column":"身份证号", + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"身份证号" + }, + { + "GroupTitle":false, + "Column":"病历号", + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"病历号" + }, + { + "GroupTitle":false, + "Column":"疾病名称", + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"疾病名称" + }, + { + "GroupTitle":false, + "Column":"批号", + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"批号" + }, + { + "GroupTitle":false, + "Column":"数量", + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"数\r\n量" + }, + { + "GroupTitle":false, + "Column":"处方医师", + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"处方医师" + }, + { + "GroupTitle":false, + "Column":"处方号", + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"处方号" + }, + { + "GroupTitle":false, + "Column":"发药人", + "Font":{ + "Name":"宋体", + "Size":120000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"发药人" + }, + { + "GroupTitle":false, + "Column":"复核人", + "Font":{ + "Name":"宋体", + "Size":120000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"复核人" + }, + { + "GroupTitle":false, + "Column":"取药人(科室)", + "Font":{ + "Name":"宋体", + "Size":120000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"取药人\r\n(科室)" + } + ] + }, + "Group":[ + { + "Name":"Group1", + "ByFields":"drugId", + "GroupHeader":{ + "PrintGridBorder":false, + "RepeatOnPage":true, + "Control":[ + { + "Type":"StaticBox", + "Name":"StaticBox15", + "Left":28.3898, + "Top":0.238125, + "Width":2.01083, + "Height":0.79375, + "Text":"生产厂家:" + }, + { + "Type":"MemoBox", + "Name":"MemoBox11", + "Left":30.3742, + "Top":0.211667, + "Width":5.3975, + "Height":0.79375, + "Text":"[#manuFactory#]" + }, + { + "Type":"StaticBox", + "Name":"StaticBox16", + "Left":0.211667, + "Width":1.79917, + "Height":0.978958, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "Text":"药品名称:" + }, + { + "Type":"FieldBox", + "Name":"FieldBox7", + "Left":2.19604, + "Width":5.79438, + "Height":0.978958, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "ShrinkFontToFit":true, + "DataField":"药品名称" + }, + { + "Type":"StaticBox", + "Name":"StaticBox17", + "Left":8.41375, + "Width":1.11125, + "Height":0.978958, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "Text":"规格:" + }, + { + "Type":"FieldBox", + "Name":"FieldBox8", + "Left":9.49854, + "Width":3.175, + "Height":0.978958, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "DataField":"规格" + }, + { + "Type":"StaticBox", + "Name":"StaticBox18", + "Left":13.0704, + "Width":1.21708, + "Height":0.978958, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "Text":"单位:" + }, + { + "Type":"FieldBox", + "Name":"FieldBox9", + "Left":14.261, + "Width":1.42875, + "Height":0.978958, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "DataField":"单位" + }, + { + "Type":"StaticBox", + "Name":"StaticBox20", + "Left":16.0073, + "Width":2.01083, + "Height":0.873125, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "Text":"生产厂家:" + }, + { + "Type":"FieldBox", + "Name":"FieldBox11", + "Left":17.9917, + "Width":8.99583, + "Height":0.873125, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "ShrinkFontToFit":true, + "DataField":"厂家" + } + ], + "NewPageColumn":"Before" + }, + "GroupFooter":{ + "Visible":false + } + } + ] + }, + "Parameter":[ + { + "Name":"machine_id" + }, + { + "Name":"startDate", + "DataType":"DateTime" + }, + { + "Name":"endDate", + "DataType":"DateTime" + } + ], + "ReportHeader":[ + { + "Name":"ReportHeader1", + "Height":1.79917, + "Control":[ + { + "Type":"MemoBox", + "Name":"MemoBox1", + "Dock":"Fill", + "Center":"Both", + "Font":{ + "Name":"宋体", + "Size":262500, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"药房麻醉药品、第一类精神药品处方登记专册" + } + ], + "RepeatOnPage":true + } + ] +} \ No newline at end of file diff --git a/DM_Weight/ReportTemp/account_book_temp-01.grf b/DM_Weight/ReportTemp/account_book_temp-01.grf new file mode 100644 index 0000000..1cf7406 --- /dev/null +++ b/DM_Weight/ReportTemp/account_book_temp-01.grf @@ -0,0 +1,742 @@ +{ + "Version":"6.8.1.1", + "Font":{ + "Name":"宋体", + "Size":105000, + "Weight":400, + "Charset":134 + }, + "Printer":{ + "LeftMargin":1, + "TopMargin":1, + "RightMargin":1, + "BottomMargin":1 + }, + "DetailGrid":{ + "CenterView":true, + "Recordset":{ + "Field":[ + { + "Name":"日期", + "Type":"DateTime", + "Format":"%d", + "DBFieldName":"operationTime" + }, + { + "Name":"批号", + "DBFieldName":"manuNo" + }, + { + "Name":"入库数量", + "Type":"Integer", + "DBFieldName":"inQuantity" + }, + { + "Name":"发药数量", + "Type":"Integer", + "DBFieldName":"outQuantity" + }, + { + "Name":"结存", + "Type":"Integer", + "DBFieldName":"stockQuantity" + }, + { + "Name":"登记人", + "DBFieldName":"operatorName" + }, + { + "Name":"核对人", + "DBFieldName":"reviewerName" + }, + { + "Name":"药品名称", + "DBFieldName":"drugName" + }, + { + "Name":"规格", + "DBFieldName":"drugSpec" + }, + { + "Name":"单位", + "DBFieldName":"bigUnit" + }, + { + "Name":"剂型", + "DBFieldName":"dosage" + }, + { + "Name":"厂家", + "DBFieldName":"manuFactory" + }, + { + "Name":"drugId" + }, + { + "Name":"年", + "Type":"Integer", + "DBFieldName":"DMYear" + }, + { + "Name":"月", + "Type":"Integer", + "DBFieldName":"DMMonth" + }, + { + "Name":"日", + "DBFieldName":"DMDay" + }, + { + "Name":"inTotal" + }, + { + "Name":"inTotalManuNo" + }, + { + "Name":"outTotal" + }, + { + "Name":"outTotalManuNo" + }, + { + "Name":"stockTotal" + }, + { + "Name":"stockTotalManuNO" + } + ] + }, + "Column":[ + { + "Name":"Column7", + "Width":1.77271 + }, + { + "Name":"Column1", + "Width":3.59833 + }, + { + "Name":"Column2", + "Width":4.81542 + }, + { + "Name":"Column3", + "Width":2.03729 + }, + { + "Name":"Column4", + "Width":1.5875 + }, + { + "Name":"Column5", + "Width":4.7625 + }, + { + "Name":"Column6", + "Width":5.21229 + } + ], + "ColumnContent":{ + "Height":0.85, + "ColumnContentCell":[ + { + "Column":"Column7", + "FreeCell":true, + "CanGrow":true, + "Control":[ + { + "Type":"StaticBox", + "Name":"StaticBox23", + "Dock":"Fill", + "CanGrow":true, + "TextAlign":"MiddleCenter", + "Text":"逐日\r\n消耗\r\n及\r\n结存\r\n情况" + } + ] + }, + { + "Column":"Column1", + "TextAlign":"MiddleCenter", + "DataField":"日" + }, + { + "Column":"Column2", + "TextAlign":"MiddleCenter", + "DataField":"批号" + }, + { + "Column":"Column3", + "TextAlign":"MiddleCenter", + "DataField":"发药数量" + }, + { + "Column":"Column4", + "TextAlign":"MiddleCenter", + "DataField":"结存" + }, + { + "Column":"Column5", + "TextAlign":"MiddleCenter", + "DataField":"登记人" + }, + { + "Column":"Column6", + "TextAlign":"MiddleCenter", + "DataField":"核对人" + } + ] + }, + "ColumnTitle":{ + "Height":0, + "RepeatStyle":"OnGroupHeaderPage", + "ColumnTitleCell":[ + { + "GroupTitle":false, + "Column":"Column7", + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + } + }, + { + "GroupTitle":false, + "Column":"Column1", + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"日期" + }, + { + "GroupTitle":false, + "Column":"Column2", + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"批号" + }, + { + "GroupTitle":false, + "Column":"Column3", + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"发药数量" + }, + { + "GroupTitle":false, + "Column":"Column4", + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"结存" + }, + { + "GroupTitle":false, + "Column":"Column5", + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"登记人" + }, + { + "GroupTitle":false, + "Column":"Column6", + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"核对人" + } + ] + }, + "Group":[ + { + "Name":"Group1", + "ByFields":"drugId", + "GroupHeader":{ + "PrintGridBorder":false, + "Control":[ + { + "Type":"StaticBox", + "Name":"StaticBox16", + "Top":0.0529167, + "Width":1.79917, + "Height":0.978958, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "Text":"药品名称:" + }, + { + "Type":"FieldBox", + "Name":"FieldBox7", + "Left":1.79917, + "Top":0.0529167, + "Width":4.20688, + "Height":0.978958, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "DataField":"药品名称" + }, + { + "Type":"StaticBox", + "Name":"StaticBox17", + "Left":6.21771, + "Top":0.0529167, + "Width":1.08479, + "Height":0.978958, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "Text":"规格:" + }, + { + "Type":"FieldBox", + "Name":"FieldBox8", + "Left":7.27604, + "Top":0.0529167, + "Width":2.32833, + "Height":0.978958, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "ShrinkFontToFit":true, + "DataField":"规格" + }, + { + "Type":"StaticBox", + "Name":"StaticBox18", + "Left":9.55146, + "Top":0.105833, + "Width":1.21708, + "Height":0.873125, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "Text":"单位:" + }, + { + "Type":"FieldBox", + "Name":"FieldBox9", + "Left":10.7421, + "Top":0.105833, + "Width":1.79917, + "Height":0.873125, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "DataField":"单位" + }, + { + "Type":"StaticBox", + "Name":"StaticBox19", + "Left":21.5371, + "Top":0.079375, + "Width":0.396875, + "Height":0.899583, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "Text":"年" + }, + { + "Type":"FieldBox", + "Name":"FieldBox10", + "Left":20.3465, + "Top":0.105833, + "Width":1.08479, + "Height":0.846667, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "DataField":"年" + }, + { + "Type":"StaticBox", + "Name":"StaticBox20", + "Left":12.8588, + "Top":0.238125, + "Width":2.01083, + "Height":0.582083, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "Text":"生产厂家:" + }, + { + "Type":"FieldBox", + "Name":"FieldBox11", + "Left":14.9225, + "Top":0.264583, + "Width":4.68313, + "Height":0.555625, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "ShrinkFontToFit":true, + "DataField":"厂家" + }, + { + "Type":"StaticBox", + "Name":"StaticBox21", + "Left":22.8865, + "Top":0.105833, + "Width":0.608542, + "Height":0.873125, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "Text":"月" + }, + { + "Type":"FieldBox", + "Name":"FieldBox16", + "Left":21.9869, + "Top":0.105833, + "Width":0.740833, + "Height":0.846667, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "DataField":"月" + } + ], + "NewPageColumn":"Before" + }, + "GroupFooter":{ + "CanGrow":true, + "CanShrink":true, + "Height":2.8046, + "Control":[ + { + "Type":"StaticBox", + "Name":"StaticBox29", + "AlignColumnSide":"Left", + "AlignColumn":"Column7", + "Top":0.211667, + "Width":2.80458, + "Height":0.582083, + "PaddingLeft":0, + "Text":"本月领药数量:" + }, + { + "Type":"StaticBox", + "Name":"StaticBox30", + "AlignColumnSide":"Left", + "AlignColumn":"Column7", + "Top":1.00542, + "Width":2.8, + "Height":0.58, + "PaddingLeft":0, + "Text":"本月发药数量:" + }, + { + "Type":"StaticBox", + "Name":"StaticBox31", + "AlignColumnSide":"Left", + "AlignColumn":"Column7", + "Top":1.79917, + "Width":2.8, + "Height":0.58, + "PaddingLeft":0, + "Text":"本月结存数量:" + }, + { + "Type":"FieldBox", + "Name":"FieldBox17", + "AlignColumnSide":"Left", + "Left":2.98979, + "Top":0.211667, + "Width":9.81604, + "Height":0.608542, + "ShrinkFontToFit":true, + "DataField":"inTotal" + }, + { + "Type":"StaticBox", + "Name":"StaticBox32", + "AlignColumnSide":"Right", + "Left":13.2556, + "Top":0.211667, + "Width":1.19063, + "Height":0.608542, + "Text":"批号:" + }, + { + "Type":"FieldBox", + "Name":"FieldBox18", + "AlignColumnSide":"Left", + "Left":2.98979, + "Top":1.00542, + "Width":9.82, + "Height":0.61, + "ShrinkFontToFit":true, + "DataField":"outTotal" + }, + { + "Type":"StaticBox", + "Name":"StaticBox34", + "AlignColumnSide":"Left", + "Left":13.2556, + "Top":1.00542, + "Width":1.19, + "Height":0.61, + "Text":"批号:" + }, + { + "Type":"FieldBox", + "Name":"FieldBox19", + "Left":14.6579, + "Top":0.211667, + "Width":8.73125, + "Height":0.582083, + "DataField":"inTotalManuNo" + }, + { + "Type":"FieldBox", + "Name":"FieldBox20", + "Left":14.6579, + "Top":1.00542, + "Width":8.73, + "Height":0.58, + "DataField":"outTotalManuNo" + }, + { + "Type":"FieldBox", + "Name":"FieldBox21", + "AlignColumnSide":"Left", + "Left":2.98979, + "Top":1.79917, + "Width":9.82, + "Height":0.61, + "ShrinkFontToFit":true, + "DataField":"stockTotal" + }, + { + "Type":"StaticBox", + "Name":"StaticBox35", + "AlignColumnSide":"Left", + "Left":13.2556, + "Top":1.79917, + "Width":1.19, + "Height":0.61, + "Text":"批号:" + }, + { + "Type":"FieldBox", + "Name":"FieldBox22", + "Left":14.6579, + "Top":1.79917, + "Width":8.73, + "Height":0.58, + "DataField":"stockTotalManuNO" + } + ] + } + }, + { + "Name":"Group2", + "GroupHeader":{ + "Height":0.608542, + "PrintGridBorder":false, + "RepeatOnPage":true, + "OccupyColumn":true, + "OccupiedColumns":"Column7", + "VAlign":"Middle" + }, + "GroupFooter":{ + "Height":0 + } + }, + { + "Name":"Group3", + "GroupHeader":{ + "Height":1.00542, + "RepeatOnPage":true, + "Control":[ + { + "Type":"StaticBox", + "Name":"StaticBox2", + "AlignColumn":"Column1", + "Left":1.77271, + "Width":3.59833, + "Height":1.00542, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"日期" + }, + { + "Type":"StaticBox", + "Name":"StaticBox3", + "AlignColumn":"Column2", + "Left":5.37104, + "Width":4.81542, + "Height":1.00542, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"批号" + }, + { + "Type":"StaticBox", + "Name":"StaticBox4", + "AlignColumn":"Column3", + "Left":10.1865, + "Width":2.03729, + "Height":1.00542, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"发药数量" + }, + { + "Type":"StaticBox", + "Name":"StaticBox5", + "AlignColumn":"Column4", + "Left":12.2238, + "Width":1.5875, + "Height":1.00542, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"结存" + }, + { + "Type":"StaticBox", + "Name":"StaticBox6", + "AlignColumn":"Column5", + "Left":13.8113, + "Width":4.7625, + "Height":1.00542, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"登记人" + }, + { + "Type":"StaticBox", + "Name":"StaticBox22", + "AlignColumn":"Column6", + "Left":18.5738, + "Width":5.21229, + "Height":1.00542, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"核对人" + } + ] + }, + "GroupFooter":{ + "Height":0 + } + } + ] + }, + "Parameter":[ + { + "Name":"machine_id" + }, + { + "Name":"startDate", + "DataType":"DateTime" + }, + { + "Name":"endDate", + "DataType":"DateTime" + } + ], + "ReportHeader":[ + { + "Name":"ReportHeader1", + "CanGrow":true, + "Height":1.5875, + "Control":[ + { + "Type":"MemoBox", + "Name":"MemoBox1", + "Dock":"Fill", + "Center":"Horizontal", + "Font":{ + "Name":"宋体", + "Size":240000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"药房麻醉药品、第一类精神药品逐日消耗专用账册" + } + ], + "RepeatOnPage":true + } + ] +} \ No newline at end of file diff --git a/DM_Weight/ReportTemp/account_book_temp-022.grf b/DM_Weight/ReportTemp/account_book_temp-022.grf new file mode 100644 index 0000000..0f22cf7 --- /dev/null +++ b/DM_Weight/ReportTemp/account_book_temp-022.grf @@ -0,0 +1,769 @@ +{ + "Version":"6.8.1.1", + "Font":{ + "Name":"宋体", + "Size":105000, + "Weight":400, + "Charset":134 + }, + "Printer":{ + "LeftMargin":1, + "TopMargin":1.5, + "RightMargin":1, + "BottomMargin":1.5 + }, + "DetailGrid":{ + "ShowColLine":false, + "ShowRowLine":false, + "PrintAdaptMethod":"ResizeToFit", + "GrowToBottom":true, + "Border":{ + "Styles":"[]" + }, + "Recordset":{ + "Field":[ + { + "Name":"批号", + "DBFieldName":"manuNo" + }, + { + "Name":"药品名称", + "DBFieldName":"drugName" + }, + { + "Name":"规格", + "DBFieldName":"drugSpec" + }, + { + "Name":"单位", + "DBFieldName":"bigUnit" + }, + { + "Name":"生产厂家", + "DBFieldName":"manufactory" + }, + { + "Name":"年", + "Type":"Integer", + "DBFieldName":"DMYear" + }, + { + "Name":"月", + "Type":"Integer", + "DBFieldName":"DMMonth" + }, + { + "Name":"日", + "Type":"Integer", + "DBFieldName":"DMDay" + }, + { + "Name":"发药数量", + "DBFieldName":"outQuantity" + }, + { + "Name":"登记人", + "DBFieldName":"operatorName" + }, + { + "Name":"核对人", + "DBFieldName":"reviewerName" + }, + { + "Name":"领药数量", + "DBFieldName":"inQuantity" + }, + { + "Name":"结存", + "DBFieldName":"stockQuantity" + }, + { + "Name":"drugId" + }, + { + "Name":"lastMonthStock" + }, + { + "Name":"lastMonthMauno" + } + ] + }, + "Column":[ + { + "Name":"Column1", + "Width":24.7385 + } + ], + "ColumnContent":{ + "Height":1.40229, + "ColumnContentCell":[ + { + "Column":"Column1", + "FreeCell":true, + "CanGrow":true, + "Control":[ + { + "Type":"SubReport", + "Name":"SubReport1", + "Dock":"Fill", + "RelationFields":"drugId", +"Report":{ + "Version":"6.8.1.1", + "Font":{ + "Name":"宋体", + "Size":105000, + "Weight":400, + "Charset":134 + }, + "Printer":{ + }, + "DetailGrid":{ + "Recordset":{ + "Field":[ + { + "Name":"日期", + "DBFieldName":"DMDay" + }, + { + "Name":"批号", + "DBFieldName":"manuNo" + }, + { + "Name":"领药数量", + "DBFieldName":"inQuantity" + }, + { + "Name":"登记人", + "DBFieldName":"operatorName" + }, + { + "Name":"核对人", + "DBFieldName":"reviewerName" + }, + { + "Name":"drugId" + } + ] + }, + "Column":[ + { + "Name":"Column7", + "Width":3.5 + }, + { + "Name":"日期", + "Width":1.98438 + }, + { + "Name":"批号", + "Width":5.97958 + }, + { + "Name":"Column4", + "Width":7.99042 + }, + { + "Name":"Column5", + "Width":4.20688 + }, + { + "Name":"Column6", + "Width":4.2069 + } + ], + "ColumnContent":{ + "Height":0.79375, + "ColumnContentCell":[ + { + "Column":"Column7", + "FreeCell":true, + "Control":[ + { + "Type":"StaticBox", + "Name":"StaticBox6", + "Dock":"Fill", + "TextAlign":"MiddleCenter", + "Text":"入库\r\n情况" + } + ] + }, + { + "Column":"日期", + "TextAlign":"MiddleCenter", + "DataField":"日期" + }, + { + "Column":"批号", + "TextAlign":"MiddleCenter", + "DataField":"批号" + }, + { + "Column":"Column4", + "TextAlign":"MiddleCenter", + "DataField":"领药数量" + }, + { + "Column":"Column5", + "TextAlign":"MiddleCenter", + "DataField":"登记人" + }, + { + "Column":"Column6", + "TextAlign":"MiddleCenter", + "DataField":"核对人" + } + ] + }, + "ColumnTitle":{ + "Height":0, + "RepeatStyle":"OnPageColumn", + "ColumnTitleCell":[ + { + "GroupTitle":false, + "Column":"Column7", + "TextAlign":"MiddleCenter", + "Text":"Column7" + }, + { + "GroupTitle":false, + "Column":"日期", + "TextAlign":"MiddleCenter", + "Text":"日期" + }, + { + "GroupTitle":false, + "Column":"批号", + "TextAlign":"MiddleCenter", + "Text":"批号" + }, + { + "GroupTitle":false, + "Column":"Column4", + "TextAlign":"MiddleCenter", + "Text":"领药数量" + }, + { + "GroupTitle":false, + "Column":"Column5", + "TextAlign":"MiddleCenter", + "Text":"登记人" + }, + { + "GroupTitle":false, + "Column":"Column6", + "TextAlign":"MiddleCenter", + "Text":"核对人" + } + ] + }, + "Group":[ + { + "Name":"Group1", + "GroupHeader":{ + "PrintGridBorder":false, + "RepeatOnPage":true, + "OccupyColumn":true, + "OccupiedColumns":"Column7", + "VAlign":"Middle" + }, + "GroupFooter":{ + "Height":0 + } + }, + { + "Name":"Group2", + "GroupHeader":{ + "Height":1.00542, + "RepeatOnPage":true, + "Control":[ + { + "Type":"StaticBox", + "Name":"日期", + "AlignColumn":"日期", + "Left":3.4925, + "Width":1.98438, + "Height":1.01, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"日期" + }, + { + "Type":"StaticBox", + "Name":"StaticBox2", + "AlignColumn":"批号", + "Left":5.47688, + "Width":5.97958, + "Height":1.01, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"批号" + }, + { + "Type":"StaticBox", + "Name":"StaticBox3", + "AlignColumn":"Column4", + "Left":11.4565, + "Width":7.99042, + "Height":1.01, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"领药数量" + }, + { + "Type":"StaticBox", + "Name":"StaticBox4", + "AlignColumn":"Column5", + "Left":19.4469, + "Width":4.20688, + "Height":1.00542, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"登记人" + }, + { + "Type":"StaticBox", + "Name":"StaticBox5", + "AlignColumn":"Column6", + "Left":23.6538, + "Width":4.20688, + "Height":1.00542, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"核对人" + } + ] + }, + "GroupFooter":{ + "Height":0 + } + } + ] + } +} + } + ] + } + ] + }, + "ColumnTitle":{ + "Height":0, + "ColumnTitleCell":[ + { + "GroupTitle":false, + "Column":"Column1", + "FreeCell":true + } + ] + }, + "Group":[ + { + "Name":"Group1", + "ByFields":"drugId", + "GroupHeader":{ + "Height":1.5875, + "PrintGridBorder":false, + "Control":[ + { + "Type":"MemoBox", + "Name":"MemoBox2", + "AlignColumnSide":"Left", + "Top":0.3, + "Width":4.60375, + "Height":0.582083, + "ShrinkFontToFit":true, + "Text":"药品名称:[#药品名称#]" + }, + { + "Type":"MemoBox", + "Name":"MemoBox3", + "Left":4.78896, + "Top":0.3, + "Width":3.38667, + "Height":0.582083, + "Text":"规格:[#规格#]" + }, + { + "Type":"MemoBox", + "Name":"MemoBox4", + "Left":8.20208, + "Top":0.3, + "Width":2.01083, + "Height":0.5821, + "Text":"单位:[#单位#]" + }, + { + "Type":"MemoBox", + "Name":"MemoBox5", + "Left":10.6098, + "Top":0.3, + "Width":5.3975, + "Height":0.5821, + "ShrinkFontToFit":true, + "Text":"厂家:[#生产厂家#]" + }, + { + "Type":"MemoBox", + "Name":"MemoBox6", + "Left":16.1131, + "Top":0.3, + "Width":1.61396, + "Height":0.5821, + "Text":"[#年#]年" + }, + { + "Type":"MemoBox", + "Name":"MemoBox7", + "Left":17.9917, + "Top":0.3, + "Width":1.40229, + "Height":0.5821, + "Text":"[#月#]月" + }, + { + "Type":"MemoBox", + "Name":"MemoBox9", + "Left":10.6098, + "Top":1.0054, + "Width":3.41313, + "Height":0.5821, + "ShrinkFontToFit":true, + "Text":"批号:[#lastMonthMauno#]" + }, + { + "Type":"MemoBox", + "Name":"MemoBox8", + "AlignColumnSide":"Left", + "Top":1.00542, + "Width":8.99583, + "Height":0.5821, + "ShrinkFontToFit":true, + "Text":"上月结存数量:[#lastMonthStock#]" + } + ] + }, + "GroupFooter":{ + "CanGrow":true, + "CanShrink":true, + "Height":1.19063, + "Control":[ + { + "Type":"SubReport", + "Name":"SubReport2", + "Dock":"Fill", + "CanShrink":true, + "RelationFields":"drugId", +"Report":{ + "Version":"6.8.1.1", + "PrintAsDesignPaper":false, + "Font":{ + "Name":"宋体", + "Size":105000, + "Weight":400, + "Charset":134 + }, + "Printer":{ + }, + "DetailGrid":{ + "Recordset":{ + "Field":[ + { + "Name":"日期", + "DBFieldName":"DMDay" + }, + { + "Name":"批号", + "DBFieldName":"manuNo" + }, + { + "Name":"发药数量", + "DBFieldName":"outQuantity" + }, + { + "Name":"结存", + "DBFieldName":"stockQuantity" + }, + { + "Name":"登记人", + "DBFieldName":"operatorName" + }, + { + "Name":"核对人", + "DBFieldName":"reviewerName" + }, + { + "Name":"drugId" + } + ] + }, + "Column":[ + { + "Name":"Column1", + "Width":3.5 + }, + { + "Name":"日期", + "Width":1.9844 + }, + { + "Name":"批号", + "Width":6.00604 + }, + { + "Name":"发药数量", + "Width":3.9953 + }, + { + "Name":"结存", + "Width":3.9952 + }, + { + "Name":"登记人", + "Width":4.2069 + }, + { + "Name":"核对人", + "Width":4.2069 + } + ], + "ColumnContent":{ + "Height":0.79375, + "ColumnContentCell":[ + { + "Column":"Column1", + "FreeCell":true, + "Control":[ + { + "Type":"StaticBox", + "Name":"StaticBox23", + "Dock":"Fill", + "TextAlign":"MiddleCenter", + "Text":"逐日消耗及\r\n结存情况" + } + ] + }, + { + "Column":"日期", + "TextAlign":"MiddleCenter", + "DataField":"日期" + }, + { + "Column":"批号", + "TextAlign":"MiddleCenter", + "DataField":"批号" + }, + { + "Column":"发药数量", + "TextAlign":"MiddleCenter", + "DataField":"发药数量" + }, + { + "Column":"结存", + "TextAlign":"MiddleCenter", + "DataField":"结存" + }, + { + "Column":"登记人", + "TextAlign":"MiddleCenter", + "DataField":"登记人" + }, + { + "Column":"核对人", + "TextAlign":"MiddleCenter", + "DataField":"核对人" + } + ] + }, + "ColumnTitle":{ + "Height":0, + "ColumnTitleCell":[ + { + "GroupTitle":false, + "Column":"Column1", + "TextAlign":"MiddleCenter", + "Text":"Column1" + }, + { + "GroupTitle":false, + "Column":"日期", + "TextAlign":"MiddleCenter", + "Text":"日期" + }, + { + "GroupTitle":false, + "Column":"批号", + "TextAlign":"MiddleCenter", + "Text":"批号" + }, + { + "GroupTitle":false, + "Column":"发药数量", + "TextAlign":"MiddleCenter", + "Text":"发药数量" + }, + { + "GroupTitle":false, + "Column":"结存", + "TextAlign":"MiddleCenter", + "Text":"结存" + }, + { + "GroupTitle":false, + "Column":"登记人", + "TextAlign":"MiddleCenter", + "Text":"登记人" + }, + { + "GroupTitle":false, + "Column":"核对人", + "TextAlign":"MiddleCenter", + "Text":"核对人" + } + ] + }, + "Group":[ + { + "Name":"Group1", + "GroupHeader":{ + "RepeatOnPage":true, + "OccupyColumn":true, + "OccupiedColumns":"Column1", + "VAlign":"Middle" + }, + "GroupFooter":{ + "Height":0 + } + }, + { + "Name":"Group2", + "GroupHeader":{ + "Height":0.79375, + "RepeatOnPage":true, + "Control":[ + { + "Type":"StaticBox", + "Name":"StaticBox2", + "AlignColumn":"日期", + "Left":3.4925, + "Width":1.98438, + "Height":1.00542, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"日期" + }, + { + "Type":"StaticBox", + "Name":"StaticBox3", + "AlignColumn":"批号", + "Left":5.47688, + "Width":6.00604, + "Height":1.00542, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"批号" + }, + { + "Type":"StaticBox", + "Name":"StaticBox4", + "AlignColumn":"发药数量", + "Left":11.4829, + "Width":3.99521, + "Height":1.00542, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"发药数量" + }, + { + "Type":"StaticBox", + "Name":"StaticBox5", + "AlignColumn":"结存", + "Left":15.4781, + "Width":3.99521, + "Height":1.00542, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"结存" + }, + { + "Type":"StaticBox", + "Name":"StaticBox6", + "AlignColumn":"登记人", + "Left":19.4733, + "Width":4.20688, + "Height":1.00542, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"登记人" + }, + { + "Type":"StaticBox", + "Name":"StaticBox22", + "AlignColumn":"核对人", + "Left":23.6802, + "Width":4.20688, + "Height":1.00542, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"核对人" + } + ] + }, + "GroupFooter":{ + "Height":0 + } + } + ] + } +} + } + ] + } + } + ] + }, + "ReportHeader":[ + { + "Name":"ReportHeader1", + "CanGrow":true, + "Height":1.5875, + "Control":[ + { + "Type":"MemoBox", + "Name":"MemoBox1", + "Dock":"Fill", + "Center":"Horizontal", + "Font":{ + "Name":"宋体", + "Size":240000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"药房麻醉药品、第一类精神药品逐日消耗专用账册" + } + ], + "RepeatOnPage":true + } + ] +} \ No newline at end of file diff --git a/DM_Weight/ReportTemp/account_book_temp-0223.grf b/DM_Weight/ReportTemp/account_book_temp-0223.grf new file mode 100644 index 0000000..4b20eda --- /dev/null +++ b/DM_Weight/ReportTemp/account_book_temp-0223.grf @@ -0,0 +1,538 @@ +{ + "Version":"6.8.1.1", + "Font":{ + "Name":"宋体", + "Size":105000, + "Weight":400, + "Charset":134 + }, + "Printer":{ + "Oriention":"Landscape" + }, + "DetailGrid":{ + "ShowColLine":false, + "ShowRowLine":false, + "PrintAdaptMethod":"ResizeToFit", + "GrowToBottom":true, + "Border":{ + "Styles":"[]" + }, + "Recordset":{ + "Field":[ + { + "Name":"批号", + "DBFieldName":"manuNo" + }, + { + "Name":"药品名称", + "DBFieldName":"drugName" + }, + { + "Name":"规格", + "DBFieldName":"drugSpec" + }, + { + "Name":"单位", + "DBFieldName":"bigUnit" + }, + { + "Name":"生产厂家", + "DBFieldName":"manufactory" + }, + { + "Name":"年", + "Type":"Integer", + "DBFieldName":"DMYear" + }, + { + "Name":"月", + "Type":"Integer", + "DBFieldName":"DMMonth" + }, + { + "Name":"日", + "Type":"Integer", + "DBFieldName":"DMDay" + }, + { + "Name":"发药数量", + "DBFieldName":"outQuantity" + }, + { + "Name":"登记人", + "DBFieldName":"operatorName" + }, + { + "Name":"核对人", + "DBFieldName":"reviewerName" + }, + { + "Name":"领药数量", + "DBFieldName":"inQuantity" + }, + { + "Name":"结存", + "DBFieldName":"stockQuantity" + }, + { + "Name":"drugId" + } + ] + }, + "Column":[ + { + "Name":"Column1", + "Width":24.7385 + } + ], + "ColumnContent":{ + "Height":0.608542, + "ColumnContentCell":[ + { + "Column":"Column1", + "FreeCell":true, + "CanGrow":true, + "Control":[ + { + "Type":"SubReport", + "Name":"SubReport1", + "Dock":"Fill", + "RelationFields":"drugId", +"Report":{ + "Version":"6.8.1.1", + "Font":{ + "Name":"宋体", + "Size":105000, + "Weight":400, + "Charset":134 + }, + "Printer":{ + "Oriention":"Landscape" + }, + "DetailGrid":{ + "Recordset":{ + "Field":[ + { + "Name":"日期", + "DBFieldName":"DMDay" + }, + { + "Name":"批号", + "DBFieldName":"manuNo" + }, + { + "Name":"领药数量", + "DBFieldName":"inQuantity" + }, + { + "Name":"登记人", + "DBFieldName":"operatorName" + }, + { + "Name":"核对人", + "DBFieldName":"reviewerName" + } + ] + }, + "Column":[ + { + "Name":"日期", + "Width":1.98438 + }, + { + "Name":"批号", + "Width":5.97958 + }, + { + "Name":"Column4", + "Width":7.99042 + }, + { + "Name":"Column5", + "Width":4.20688 + }, + { + "Name":"Column6", + "Width":4.2069 + } + ], + "ColumnContent":{ + "Height":2.01083, + "ColumnContentCell":[ + { + "Column":"日期", + "TextAlign":"MiddleCenter", + "DataField":"日期" + }, + { + "Column":"批号", + "TextAlign":"MiddleCenter", + "DataField":"批号" + }, + { + "Column":"Column4", + "TextAlign":"MiddleCenter", + "DataField":"领药数量" + }, + { + "Column":"Column5", + "TextAlign":"MiddleCenter", + "DataField":"登记人" + }, + { + "Column":"Column6", + "TextAlign":"MiddleCenter", + "DataField":"核对人" + } + ] + }, + "ColumnTitle":{ + "Height":1, + "RepeatStyle":"OnPageColumn", + "ColumnTitleCell":[ + { + "GroupTitle":false, + "Column":"日期", + "TextAlign":"MiddleCenter", + "Text":"日期" + }, + { + "GroupTitle":false, + "Column":"批号", + "TextAlign":"MiddleCenter", + "Text":"批号" + }, + { + "GroupTitle":false, + "Column":"Column4", + "TextAlign":"MiddleCenter", + "Text":"领药数量" + }, + { + "GroupTitle":false, + "Column":"Column5", + "TextAlign":"MiddleCenter", + "Text":"登记人" + }, + { + "GroupTitle":false, + "Column":"Column6", + "TextAlign":"MiddleCenter", + "Text":"核对人" + } + ] + } + }, + "ReportHeader":[ + { + "Name":"ReportHeader1", + "Height":1.00542, + "Control":[ + { + "Type":"StaticBox", + "Name":"StaticBox1", + "Left":10.2129, + "Width":3.38667, + "Height":1.00542, + "Font":{ + "Name":"宋体", + "Size":150000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"入库情况" + } + ] + } + ] +} + } + ] + } + ] + }, + "ColumnTitle":{ + "Height":0, + "ColumnTitleCell":[ + { + "GroupTitle":false, + "Column":"Column1", + "FreeCell":true + } + ] + }, + "Group":[ + { + "Name":"Group1", + "ByFields":"drugId;年;月", + "GroupHeader":{ + "Height":1.00542, + "PrintGridBorder":false, + "Control":[ + { + "Type":"MemoBox", + "Name":"MemoBox2", + "Left":0.608542, + "Top":0.211667, + "Width":3.99521, + "Height":0.582083, + "Text":"品名:[#药品名称#]" + }, + { + "Type":"MemoBox", + "Name":"MemoBox3", + "Left":5.60917, + "Top":0.211667, + "Width":3.9952, + "Height":0.582083, + "Text":"规格:[#规格#]" + }, + { + "Type":"MemoBox", + "Name":"MemoBox4", + "Left":9.39271, + "Top":0.211667, + "Width":3.01625, + "Height":0.608542, + "Text":"单位:[#单位#]" + }, + { + "Type":"MemoBox", + "Name":"MemoBox5", + "Left":12.8058, + "Top":0.211667, + "Width":7.19667, + "Height":0.5821, + "Text":"厂家:[#生产厂家#]" + }, + { + "Type":"MemoBox", + "Name":"MemoBox6", + "Left":21.3254, + "Top":0.185208, + "Width":1.61396, + "Height":0.5821, + "Text":"[#年#]年" + }, + { + "Type":"MemoBox", + "Name":"MemoBox7", + "Left":22.9394, + "Top":0.185208, + "Width":1.66688, + "Height":0.5821, + "Text":"[#月#]月" + } + ] + }, + "GroupFooter":{ + "CanGrow":true, + "CanShrink":true, + "Height":2.01083, + "Control":[ + { + "Type":"SubReport", + "Name":"SubReport2", + "Dock":"Fill", + "CanShrink":true, + "RelationFields":"drugId", +"Report":{ + "Version":"6.8.1.1", + "PrintAsDesignPaper":false, + "Font":{ + "Name":"宋体", + "Size":105000, + "Weight":400, + "Charset":134 + }, + "Printer":{ + "Oriention":"Landscape" + }, + "DetailGrid":{ + "Recordset":{ + "Field":[ + { + "Name":"日期", + "DBFieldName":"DMDay" + }, + { + "Name":"批号", + "DBFieldName":"manuNo" + }, + { + "Name":"发药数量", + "DBFieldName":"outQuantity" + }, + { + "Name":"结存", + "DBFieldName":"stockQuantity" + }, + { + "Name":"登记人", + "DBFieldName":"operatorName" + }, + { + "Name":"核对人", + "DBFieldName":"reviewerName" + } + ] + }, + "Column":[ + { + "Name":"日期", + "Width":1.9844 + }, + { + "Name":"批号", + "Width":6.00604 + }, + { + "Name":"发药数量", + "Width":3.9953 + }, + { + "Name":"结存", + "Width":3.9952 + }, + { + "Name":"登记人", + "Width":4.2069 + }, + { + "Name":"核对人", + "Width":4.2069 + } + ], + "ColumnContent":{ + "Height":0.79375, + "ColumnContentCell":[ + { + "Column":"日期", + "TextAlign":"MiddleCenter", + "DataField":"日期" + }, + { + "Column":"批号", + "TextAlign":"MiddleCenter", + "DataField":"批号" + }, + { + "Column":"发药数量", + "TextAlign":"MiddleCenter", + "DataField":"发药数量" + }, + { + "Column":"结存", + "TextAlign":"MiddleCenter", + "DataField":"结存" + }, + { + "Column":"登记人", + "TextAlign":"MiddleCenter", + "DataField":"登记人" + }, + { + "Column":"核对人", + "TextAlign":"MiddleCenter", + "DataField":"核对人" + } + ] + }, + "ColumnTitle":{ + "Height":1, + "ColumnTitleCell":[ + { + "GroupTitle":false, + "Column":"日期", + "TextAlign":"MiddleCenter", + "Text":"日期" + }, + { + "GroupTitle":false, + "Column":"批号", + "TextAlign":"MiddleCenter", + "Text":"批号" + }, + { + "GroupTitle":false, + "Column":"发药数量", + "TextAlign":"MiddleCenter", + "Text":"发药数量" + }, + { + "GroupTitle":false, + "Column":"结存", + "TextAlign":"MiddleCenter", + "Text":"结存" + }, + { + "GroupTitle":false, + "Column":"登记人", + "TextAlign":"MiddleCenter", + "Text":"登记人" + }, + { + "GroupTitle":false, + "Column":"核对人", + "TextAlign":"MiddleCenter", + "Text":"核对人" + } + ] + } + }, + "ReportHeader":[ + { + "Name":"ReportHeader1", + "Height":0.79375, + "Control":[ + { + "Type":"StaticBox", + "Name":"StaticBox1", + "Left":8.99583, + "Width":5.60917, + "Height":0.79375, + "Font":{ + "Name":"宋体", + "Size":150000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"逐日消耗与结存情况" + } + ] + } + ] +} + } + ] + } + } + ] + }, + "ReportHeader":[ + { + "Name":"ReportHeader1", + "CanGrow":true, + "Height":1.00542, + "Control":[ + { + "Type":"MemoBox", + "Name":"MemoBox1", + "Dock":"Fill", + "Center":"Horizontal", + "Font":{ + "Name":"宋体", + "Size":262500, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"药房麻醉药品、第一类精神药品逐日消耗专用账册" + } + ], + "RepeatOnPage":true + } + ] +} \ No newline at end of file diff --git a/DM_Weight/ReportTemp/return_empty.grf b/DM_Weight/ReportTemp/return_empty.grf new file mode 100644 index 0000000..363ddcd --- /dev/null +++ b/DM_Weight/ReportTemp/return_empty.grf @@ -0,0 +1,424 @@ +{ + "Version":"6.8.1.1", + "Font":{ + "Name":"宋体", + "Size":105000, + "Weight":400, + "Charset":134 + }, + "Printer":{ + "LeftMargin":0.3175, + "TopMargin":0.899583, + "RightMargin":0.396875 + }, + "DetailGrid":{ + "CenterView":true, + "Recordset":{ + "QuerySQL":"SELECT \r\n dmr.`drawer_no` AS drawerNo,\r\n dmr.`col_no` AS colNo,\r\n dmr.`type` AS `type`,\r\n CONCAT(dmr.`quantity`,IF(dmr.`type`=32,\"(空瓶)\",\"\")) AS quantity,\r\n dmr.`manu_no` AS manuNo,\r\n dmr.`eff_date` AS effDate,\r\n dmr.`operation_time` AS operationTime,\r\n di.`drug_name` AS drugName,\r\n di.`drug_spec` AS drugSpec,\r\n di.`pack_unit` AS packUnit,\r\n di.`manufactory` AS manuFactory,\r\n di.`max_stock` AS baseQuantity,\r\n dmr.`drug_id` AS drugId,\r\n ul.`user_name` AS nickname\r\nFROM\r\n dm_machine_record dmr\r\nLEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id`\r\nLEFT JOIN user_list ul ON ul.`id` = dmr.`Operator`\r\nWHERE dmr.`type` in (31, 32)\r\n AND dmr.`machine_id` = :machine_id\r\n AND dmr.`operation_time` > :startDate\r\n AND dmr.`operation_time` < :endDate", + "Field":[ + { + "Name":"患者姓名", + "DBFieldName":"P_name" + }, + { + "Name":"时间", + "Type":"DateTime", + "Format":"MM/dd", + "DBFieldName":"operation_time" + }, + { + "Name":"药品名称", + "DBFieldName":"drug_name" + }, + { + "Name":"数量", + "DBFieldName":"Quantity" + }, + { + "Name":"批次", + "DBFieldName":"manu_no" + }, + { + "Name":"效期", + "Type":"DateTime", + "Format":"yyyy/MM/dd", + "DBFieldName":"effDate" + }, + { + "Name":"使用科室", + "DBFieldName":"dept_name" + }, + { + "Name":"交回人", + "DBFieldName":"returnPerson" + }, + { + "Name":"年", + "Type":"Integer", + "DBFieldName":"dmYear" + }, + { + "Name":"接受人", + "DBFieldName":"receivePerson" + }, + { + "Name":"drug_id" + } + ] + }, + "Column":[ + { + "Name":"Column2" + }, + { + "Name":"患者姓名", + "Width":3.78354 + }, + { + "Name":"使用科室", + "Width":4.63021 + }, + { + "Name":"数量", + "Width":1.37583 + }, + { + "Name":"批次", + "Width":1.79917 + }, + { + "Name":"交回人", + "Width":2.40771 + }, + { + "Name":"接受人", + "Width":2.40771 + } + ], + "ColumnContent":{ + "Height":4.78896, + "ColumnContentCell":[ + { + "Column":"Column2", + "TextAlign":"MiddleCenter", + "DataField":"时间" + }, + { + "Column":"患者姓名", + "TextAlign":"MiddleCenter", + "DataField":"患者姓名" + }, + { + "Column":"使用科室", + "TextAlign":"MiddleCenter", + "DataField":"使用科室" + }, + { + "Column":"数量", + "TextAlign":"MiddleCenter", + "DataField":"数量" + }, + { + "Column":"批次", + "TextAlign":"MiddleCenter", + "DataField":"批次" + }, + { + "Column":"交回人", + "TextAlign":"MiddleCenter", + "DataField":"交回人" + }, + { + "Column":"接受人", + "TextAlign":"MiddleCenter", + "DataField":"接受人" + } + ] + }, + "ColumnTitle":{ + "Height":1.40229, + "RepeatStyle":"OnPage", + "ColumnTitleCell":[ + { + "GroupTitle":true, + "Name":"Column1", + "ColumnTitleCell":[ + { + "GroupTitle":false, + "Column":"Column2", + "Font":{ + "Name":"宋体", + "Size":120000, + "Bold":true, + "Charset":134 + }, + "FreeCell":true, + "Control":[ + { + "Type":"FieldBox", + "Name":"FieldBox12", + "Left":1.00542, + "Width":1.40229, + "Height":0.582083, + "DataField":"年" + } + ] + } + ], + "Font":{ + "Name":"宋体", + "Size":120000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"回收日期" + }, + { + "GroupTitle":false, + "Column":"患者姓名", + "Font":{ + "Name":"宋体", + "Size":120000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"患者姓名" + }, + { + "GroupTitle":false, + "Column":"使用科室", + "Font":{ + "Name":"宋体", + "Size":120000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"使用科室" + }, + { + "GroupTitle":false, + "Column":"数量", + "Font":{ + "Name":"宋体", + "Size":120000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"数量" + }, + { + "GroupTitle":false, + "Column":"批次", + "Font":{ + "Name":"宋体", + "Size":120000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"批号" + }, + { + "GroupTitle":false, + "Column":"交回人", + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"交回人" + }, + { + "GroupTitle":false, + "Column":"接受人", + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"接受人" + } + ] + }, + "Group":[ + { + "Name":"Group2", + "ByFields":"drug_id", + "GroupHeader":{ + "PrintGridBorder":false, + "RepeatOnPage":true, + "Control":[ + { + "Type":"StaticBox", + "Name":"StaticBox16", + "Top":0.0529167, + "Width":1.79917, + "Height":0.978958, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "Text":"药品名称:" + }, + { + "Type":"FieldBox", + "Name":"FieldBox7", + "Left":1.98438, + "Width":4.23333, + "Height":0.978958, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "DataField":"药品名称" + }, + { + "Type":"StaticBox", + "Name":"StaticBox17", + "Left":6.56167, + "Top":0.0529167, + "Width":1.11125, + "Height":0.978958, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "Text":"规格:" + }, + { + "Type":"FieldBox", + "Name":"FieldBox8", + "Left":7.64646, + "Top":0.0529167, + "Width":1.74625, + "Height":0.978958, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + } + }, + { + "Type":"StaticBox", + "Name":"StaticBox18", + "Left":10.2923, + "Top":0.0529167, + "Width":1.21708, + "Height":0.978958, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "Text":"单位:" + }, + { + "Type":"FieldBox", + "Name":"FieldBox9", + "Left":11.4829, + "Top":0.0529167, + "Width":1.42875, + "Height":0.978958, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + } + }, + { + "Type":"StaticBox", + "Name":"StaticBox20", + "Left":12.9117, + "Width":2.01083, + "Height":0.978958, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "Text":"生产厂家:" + }, + { + "Type":"FieldBox", + "Name":"FieldBox11", + "Left":14.9225, + "Width":6.87917, + "Height":0.978958, + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + } + } + ], + "NewPageColumn":"Before" + }, + "GroupFooter":{ + "Visible":false + } + } + ] + }, + "Parameter":[ + { + "Name":"startDate", + "DataType":"DateTime", + "Format":"yyyy-MM-dd hh:mm:ss", + "Value":"2023/1/1" + }, + { + "Name":"endDate", + "DataType":"DateTime", + "Format":"yyyy-MM-dd hh:mm:ss", + "Value":"2023/4/28 23:59:59" + }, + { + "Name":"machine_id", + "Value":"DM1" + } + ], + "ReportHeader":[ + { + "Name":"ReportHeader1", + "Height":1.79917, + "Control":[ + { + "Type":"MemoBox", + "Name":"MemoBox2", + "Left":0.396875, + "Top":0.211667, + "Width":19.6056, + "Height":1.19063, + "Font":{ + "Name":"宋体", + "Size":217500, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"麻醉药品、第一类精神药品空安瓿(废贴)回收登记本" + } + ], + "RepeatOnPage":true + } + ] +} \ No newline at end of file diff --git a/DM_Weight/ViewModels/MachineRecordWindowViewModel.cs b/DM_Weight/ViewModels/MachineRecordWindowViewModel.cs index 2169348..72327a1 100644 --- a/DM_Weight/ViewModels/MachineRecordWindowViewModel.cs +++ b/DM_Weight/ViewModels/MachineRecordWindowViewModel.cs @@ -341,6 +341,22 @@ namespace DM_Weight.ViewModels } public bool KeepAlive => true; + //导出处方登记专册 + public DelegateCommand AccountCommand + { + get => new DelegateCommand(() => { + GridReportUtil.PrintReportOrderAccount(DrugInfo==null?"":DrugInfo.DrugId, StartDate, EndDate); + }); + } + + //导出回收登记记录 + public DelegateCommand ReturnRecordCommand + { + get => new DelegateCommand(() => + { + GridReportUtil.PrintReportReturnEmpty(StartDate, EndDate); + }); + } } } diff --git a/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs b/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs index 65aaf88..bc7e130 100644 --- a/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs @@ -35,6 +35,15 @@ namespace DM_Weight.ViewModels private static readonly DateTime Jan1st1970 = new DateTime (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + + //取药人(科室) + private string receivePerson; + public string ReceivePerson + { + get => receivePerson; + set => SetProperty(ref receivePerson, value); + } + private PortUtil _portUtil; IEventAggregator _eventAggregator; IDialogService _dialogService; @@ -429,7 +438,8 @@ namespace DM_Weight.ViewModels StockQuantity = nowChannels.Sum(it => it.Quantity), ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity), SupplierDept = ConfigurationManager.AppSettings["receiveDept"].ToString(), - ReceiveDept = OrderInfo.DeptName + ReceiveDept = OrderInfo.DeptName, + ReceivePerson=ReceivePerson }).ExecuteCommand(); } return true; diff --git a/DM_Weight/ViewModels/ReturnEmptyDialogViewModel.cs b/DM_Weight/ViewModels/ReturnEmptyDialogViewModel.cs index 8b1de04..bc6b089 100644 --- a/DM_Weight/ViewModels/ReturnEmptyDialogViewModel.cs +++ b/DM_Weight/ViewModels/ReturnEmptyDialogViewModel.cs @@ -20,6 +20,7 @@ using DM_Weight.util; using DM_Weight.Views; using SqlSugar; using System.Threading.Channels; +using DM_Weight.Report; namespace DM_Weight.ViewModels { @@ -144,6 +145,20 @@ namespace DM_Weight.ViewModels set => SetProperty(ref _channelStock, value); } + //接受人 + private string receivePerson; + public string ReceivePerson + { + get => receivePerson; + set => SetProperty(ref receivePerson, value); + } + //还药人 + private string returnPerson; + public string ReturnPerson + { + get => returnPerson; + set => SetProperty(ref returnPerson, value); + } public bool CanCloseDialog() @@ -170,8 +185,17 @@ namespace DM_Weight.ViewModels public void RequestData() { + //List queryData = SqlSugarHelper.Db.Queryable() + // .Includes(mr => mr.User) + // .Where(mr => mr.DrugId == ChannelStock.DrugId) + // .Where(mr => mr.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")) + // .Where(mr => mr.Type == 2) + // .Where(mr => mr.Status != 2) + // .OrderBy(mr => mr.OperationTime) + // .OrderBy(mr => mr.Id) + // .ToList(); List queryData = SqlSugarHelper.Db.Queryable() - .Includes(mr => mr.User) + .Includes(mr => mr.orderInfo) .Where(mr => mr.DrugId == ChannelStock.DrugId) .Where(mr => mr.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")) .Where(mr => mr.Type == 2) @@ -214,7 +238,7 @@ namespace DM_Weight.ViewModels if (App.CurrentFaUserList.Role != null) { //查看当前用户是否有所在药品抽屉的权限 - bool bLessEight = ChannelStock.DrawerNo<= 8; + bool bLessEight = ChannelStock.DrawerNo <= 8; bool bMoreEight = ChannelStock.DrawerNo > 8; bool bEqualEight = ChannelStock.DrawerNo == 17; if (bLessEight) @@ -335,10 +359,12 @@ namespace DM_Weight.ViewModels EffDate = !String.IsNullOrEmpty(ChannelStock.EffDate) ? DateTime.ParseExact(ChannelStock.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null, Operator = HomeWindowViewModel.Operator?.Id, Reviewer = HomeWindowViewModel.Reviewer?.Id, + ReturnPerson = ReturnPerson, + ReceivePerson = ReceivePerson, OperationTime = DateTime.Now, Quantity = ReturnQuantity, Type = 32, - InvoiceId = InvoiceId, + InvoiceId = _MachineRecord.InvoiceId, //InvoiceId, GetId = _MachineRecord.Id, StockQuantity = nowChannels.Sum(it => it.Quantity), ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == ChannelStock.ManuNo).Sum(it => it.Quantity) @@ -421,5 +447,6 @@ namespace DM_Weight.ViewModels } public bool KeepAlive => true; + } } diff --git a/DM_Weight/ViewModels/ReturnEmptyWindowViewModel.cs b/DM_Weight/ViewModels/ReturnEmptyWindowViewModel.cs index 0ffd42d..97b09c4 100644 --- a/DM_Weight/ViewModels/ReturnEmptyWindowViewModel.cs +++ b/DM_Weight/ViewModels/ReturnEmptyWindowViewModel.cs @@ -10,6 +10,7 @@ using System.Text; using System.Threading.Tasks; using DM_Weight.Models; using DM_Weight.util; +using DM_Weight.Report; namespace DM_Weight.ViewModels { diff --git a/DM_Weight/ViewModels/RoleManagerWindowViewModel.cs b/DM_Weight/ViewModels/RoleManagerWindowViewModel.cs index d84e698..ef9378b 100644 --- a/DM_Weight/ViewModels/RoleManagerWindowViewModel.cs +++ b/DM_Weight/ViewModels/RoleManagerWindowViewModel.cs @@ -349,6 +349,12 @@ namespace DM_Weight.ViewModels PremissionName = "账册", PremissionPath = "AccountWindow", }; + PremissionDm kuguan66 = new PremissionDm + { + Id = 466, + PremissionName = "专用账册", + PremissionPath = "SpecialAccountWindow", + }; //PremissionDm kuguan7 = new PremissionDm //{ // Id = 47, @@ -361,6 +367,7 @@ namespace DM_Weight.ViewModels kuguanChild.Add(kuguan4); kuguanChild.Add(kuguan5); kuguanChild.Add(kuguan6); + kuguanChild.Add(kuguan66); //kuguanChild.Add(kuguan7); kuguan.Children = kuguanChild; defaultAll.Add(kuguan); diff --git a/DM_Weight/ViewModels/SpecialAccountWindowViewModel.cs b/DM_Weight/ViewModels/SpecialAccountWindowViewModel.cs new file mode 100644 index 0000000..26a8dcd --- /dev/null +++ b/DM_Weight/ViewModels/SpecialAccountWindowViewModel.cs @@ -0,0 +1,302 @@ +using DM_Weight.Models; +using DM_Weight.msg; +using DM_Weight.Report; +using DM_Weight.Services; +using DM_Weight.util; +using Prism.Commands; +using Prism.Events; +using Prism.Mvvm; +using Prism.Regions; +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DM_Weight.ViewModels +{ + internal class SpecialAccountWindowViewModel : BindableBase, INavigationAware, IRegionMemberLifetime + { + public static SpecialAccountWindowViewModel vm; + private DateTime? _startDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); + + private DateTime? nowDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); + + public DateTime? StartDate + { + get => _startDate; + set + { + if (value != null) + { + SetProperty(ref _startDate, new DateTime(value?.Year ?? 0, value?.Month ?? 0, value?.Day ?? 0)); + } + else + { + SetProperty(ref _startDate, value); + } + } + } + + private DateTime? _endDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59); + + public DateTime? EndDate + { + get => _endDate; + set + { + if (value != null) + { + TimeSpan ershisi = new TimeSpan(23, 59, 59); + SetProperty(ref _endDate, new DateTime(value?.Year ?? 0, value?.Month ?? 0, value?.Day ?? 0, 23, 59, 59)); + } + else + { + SetProperty(ref _endDate, value); + } + } + } + private static readonly DateTime Jan1st1970 = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + /// + /// 账册 + /// + private List _accountList = new(); + + public List AccountList + { + get => _accountList; + set => SetProperty(ref _accountList, value); + } + /// + /// 药品 + /// + private List? _drugInfos; + + public List? DrugInfos + { + get => _drugInfos; + set => SetProperty(ref _drugInfos, value); + } + private DrugInfo? _drugInfo; + + public DrugInfo? DrugInfo + { + get => _drugInfo; + set + { + SetProperty(ref _drugInfo, value); + } + } + MachineRecordService _machineRecordService; + ChannelStockService _channelStockService; + IEventAggregator _eventAggregator; + public SpecialAccountWindowViewModel(MachineRecordService machineRecord, ChannelStockService channelStockService, IEventAggregator eventAggregator) + { + _machineRecordService = machineRecord; + _channelStockService = channelStockService; + _eventAggregator = eventAggregator; + vm = this; + } + private void GetAllDrugInfos() + { + var list = SqlSugarHelper.Db.Queryable().Includes(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList(); + DrugInfos = list; + DrugInfo = list[0]; + } + + /// + /// 生成日结存 + /// + public DelegateCommand DayAccountBook + { + get => new DelegateCommand(() => + { + DayAccountAction(); + }); + } + //生成一条当日没有记录的账册记录 + private void DayAccountAction() + { + try + { + string machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"; + //根据已生成的日结存记录 + int deleteNum = SqlSugarHelper.Db.Deleteable() + .Where(cs => cs.Type.Equals(5) && cs.OperationTime.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd") && cs.MachineId.Equals(machineId)).ExecuteCommand(); + int inQuantity = 0; //当日入库量 + int outQuantity = 0; //当日出库量 + //查询账册中所有记录,与库存中的记录做比校,如果账册中没有,则添加一条,有则添加一条总日结存 + List accountList = _machineRecordService.ReportAccountBook(nowDate, null, 0); + //库存中的记录 + List channelStockList = _channelStockService.GetAll(); + //List channelStockInsert = new List(); + if (accountList != null && accountList.Count() > 0) + { + //账册中有记录则与库存记录对比 + + for (int i = 0; i < channelStockList.Count; i++) + { + string drugId = channelStockList[i].DrugId; + string manuNo = channelStockList[i].ManuNo; + int quantity= channelStockList[i] .Quantity; + int Count = accountList.Where(cs => cs.DrugId == drugId && cs.ManuNo == manuNo).Count(); + + if (Count <= 0) + { + inQuantity = 0; + outQuantity = 0; + } + else + { + inQuantity = accountList.Where(cs => cs.DrugId == drugId&&cs.ManuNo== manuNo).Sum(cs => cs.InQuantity); + outQuantity = accountList.Where(cs => cs.DrugId == drugId && cs.ManuNo == manuNo).Sum(cs => cs.OutQuantity); + } + // 获取药品总库存 + int channelStockQuantity = SqlSugarHelper.Db.Queryable() + .Where(cs => cs.DrugId.Equals(drugId)).Sum(it => it.Quantity); + //没有直接插入 + // 保存数据 出/入库记录 + string InvoiceId = "Account_" + CurrentTimeMillis(); + SqlSugarHelper.Db.Insertable(new MachineRecord() + { + MachineId = channelStockList[i].MachineId, + DrawerNo = 0,//channelStockList[i].DrawerNo, + ColNo = 0,// channelStockList[i].ColNo,FV + DrugId = drugId, + ManuNo = manuNo, + EffDate = null,// !String.IsNullOrEmpty(channelStockList[i].EffDate) ? DateTime.ParseExact(channelStockList[i].EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null, + Operator = HomeWindowViewModel.Operator?.Id, + Reviewer = HomeWindowViewModel.Reviewer?.Id, + OperationTime = DateTime.Now, + Quantity = 0, + Type = 5, + InvoiceId = "日结存",//InvoiceId, + ReturnQuantity1 = inQuantity, //当日入库量总数 + ReturnQuantity2 = outQuantity, //当日出库量总数 + StockQuantity = channelStockQuantity, + ManunoQuantity = quantity, + SupplierDept = string.Empty,// ConfigurationManager.AppSettings["supplierDept"].ToString(), + ReceiveDept = string.Empty,//ConfigurationManager.AppSettings["receiveDept"].ToString() + }).ExecuteCommand(); + + + } + } + else + { + for (int i = 0; i < channelStockList.Count; i++) + { + //账册中没有记录则把库存中的所有数据都要生成一条账册记录 + // 保存数据 出/入库记录 + // 获取药品总库存 + string drugId = channelStockList[i].DrugId; + string manuNo = channelStockList[i].ManuNo; + int quantity = channelStockList[i].Quantity; + int channelStockQuantity = SqlSugarHelper.Db.Queryable() + .Where(cs => cs.DrugId.Equals(drugId)).Sum(it => it.Quantity); + + + string InvoiceId = "Account_" + CurrentTimeMillis(); + SqlSugarHelper.Db.Insertable(new MachineRecord() + { + MachineId = channelStockList[i].MachineId, + DrawerNo = 0,//channelStockList[i].DrawerNo, + ColNo = 0,//channelStockList[i].ColNo, + DrugId = drugId, + ManuNo = manuNo,// channelStockList[i].ManuNo, + EffDate = null,// !String.IsNullOrEmpty(channelStockList[i].EffDate) ? DateTime.ParseExact(channelStockList[i].EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null, + Operator = HomeWindowViewModel.Operator?.Id, + Reviewer = HomeWindowViewModel.Reviewer?.Id, + OperationTime = DateTime.Now, + Quantity = 0, + Type = 5, + InvoiceId = "日结存",// string.Empty,//InvoiceId, + ReturnQuantity1 = inQuantity, //当日入库量总数 + ReturnQuantity2 = outQuantity, //当日出库量总数 + StockQuantity = channelStockQuantity, + ManunoQuantity = quantity, + SupplierDept = string.Empty,//ConfigurationManager.AppSettings["supplierDept"].ToString(), + ReceiveDept = string.Empty,//ConfigurationManager.AppSettings["receiveDept"].ToString() + }).ExecuteCommand(); + } + } + AlertMsg alertMsg = new AlertMsg + { + Message = "日结存已生成完成", + Type = MsgType.SUCCESS, + }; + _eventAggregator.GetEvent().Publish(alertMsg); + } + catch (Exception ex) + { + AlertMsg alertMsg = new AlertMsg + { + Message = "生成日结存失败", + Type = MsgType.ERROR, + }; + _eventAggregator.GetEvent().Publish(alertMsg); + } + } + public long CurrentTimeMillis() + { + return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds; + } + /// + /// 导出账册 + /// + public DelegateCommand DownloadAccountBook + { + get => new DelegateCommand(() => + { + GridReportUtil.PrintReportSpecialAccount(EndDate?? DateTime.Now, DrugInfo == null ? "" : DrugInfo.DrugId); + + }); + } + /// + /// 导出账册2 + /// + public DelegateCommand DownloadAccountBook2 + { + get => new DelegateCommand(() => + { + GridReportUtil.PrintReportSpecialAccount2New(EndDate?? DateTime.Now, DrugInfo == null ? "" : DrugInfo.DrugId); + + }); + } + public bool KeepAlive => true; + + public void UpdateComboBoxItems(string text) + { + string str = @"SELECT d.drug_id,d.py_code,d.drug_barcode,d.drug_name,d.drug_brand_name,d.drug_spec,d.dosage,d.pack_unit, + d.manufactory,d.max_stock FROM `drug_info` d"; + if (string.IsNullOrEmpty(text)) + { + DrugInfos = SqlSugarHelper.Db.SqlQueryable(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList(); + return; + } + if (DrugInfos != null) + { + DrugInfos.Clear(); + } + + DrugInfos = SqlSugarHelper.Db.SqlQueryable(str).Where(di => di.DrugName.Contains(text) || di.PyCode.Contains(text) || di.DrugId.Contains(text)).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList(); + + } + + public void OnNavigatedTo(NavigationContext navigationContext) + { + //药品信息 + GetAllDrugInfos(); + } + + public bool IsNavigationTarget(NavigationContext navigationContext) + { + return true; + } + + public void OnNavigatedFrom(NavigationContext navigationContext) + { + } + } +} diff --git a/DM_Weight/Views/Dialog/OrderTakeDialog.xaml b/DM_Weight/Views/Dialog/OrderTakeDialog.xaml index 651c5e2..2cdc78c 100644 --- a/DM_Weight/Views/Dialog/OrderTakeDialog.xaml +++ b/DM_Weight/Views/Dialog/OrderTakeDialog.xaml @@ -191,6 +191,10 @@ Content="取药" Command="{Binding OpenDrawer}"> --> + --> + + + + + + + + + + diff --git a/DM_Weight/Views/SpecialAccountWindow.xaml.cs b/DM_Weight/Views/SpecialAccountWindow.xaml.cs new file mode 100644 index 0000000..69482af --- /dev/null +++ b/DM_Weight/Views/SpecialAccountWindow.xaml.cs @@ -0,0 +1,51 @@ +using DM_Weight.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace DM_Weight.Views +{ + /// + /// SpecialAccountWindow.xaml 的交互逻辑 + /// + public partial class SpecialAccountWindow : UserControl + { + SpecialAccountWindowViewModel vms; + public SpecialAccountWindow() + { + InitializeComponent(); + } + /// + /// 药品名称下拉框 + /// + /// + /// + private void ComboBox_KeyUp(object sender, KeyEventArgs e) + { + ComboBox comboBox = sender as ComboBox; + vms.UpdateComboBoxItems(comboBox.Text); + if (this.vms.DrugInfos.Count > 0) + { + comboBox.IsDropDownOpen = true; + } + TextBox textBox = (TextBox)comboBox.Template.FindName("PART_EditableTextBox", comboBox); + textBox.SelectionStart = textBox.Text.Length; + } + + private void UserControl_Loaded(object sender, RoutedEventArgs e) + { + vms = SpecialAccountWindowViewModel.vm; + } + } +}