public static void Fill3000(SvodDdr.DdrDataContext dc) { dc.context.ReportProgress(@"Заполняем форму 3000 ..."); var ws = ((Worksheet)dc.newDoc.Worksheets[@"стр.5"]); ws.Activate(); var totalRow = new RowData(); var sqlText = string.Format(@"SELECT COUNT(DISTINCT Event.client_id) as CountClients, COUNT(DISTINCT IF(Action.MKB != '' AND Action.MKB NOT LIKE 'Z%', Event.id, NULL)) as CountEvents, ActionType.code AS ActionTypeCode FROM Event INNER JOIN EventType ON (Event.`deleted` = 0) AND (EventType.`code` IN ('dd2013_2')) AND (EventType.`id` = Event.`eventType_id`) AND (EventType.`deleted` = 0) INNER JOIN Action ON (Action.`deleted` = 0) /* AND (Action.`status` != 3) */ AND (Action.`event_id` = Event.`id`) INNER JOIN ActionType ON (ActionType.`deleted` = 0) AND (Action.`actionType_id` = ActionType.`id`) INNER JOIN Client ON (Client.`deleted` = 0) AND (Client.`id` = Event.`client_id`) WHERE (Event.`execDate` >= '{0}') AND (Event.`execDate` < '{1}') AND (Action.`status` != 3) AND (Action.`status` != 6) GROUP BY ActionType.code", dc.dateEnd.BeginOfYear().SqlStr(), dc.dateEnd.AddDays(1).SqlStr()); var sqlData = selectSqlData<SourceData>(dc, sqlText); for (int rowIndex = 7; rowIndex <= 19; rowIndex++) { fillRow(dc, rowIndex, totalRow, ws, sqlData); } totalRow.FillData(ws, 20); dc.context.ProgressSeparator(); }
private static void fillRow(SvodDdr.DdrDataContext dc, int rowIndex, RowData totalRow, Worksheet ws, List<SourceData> sqlData) { var rowData = new RowData(); var row = (Range)ws.Rows[rowIndex]; string serviceCode = ((Range)row.Cells[1, serviceCodeColumn]).Value2.ToString(); serviceCode = serviceCode.ToUpper(); var serviceCodes = serviceCode.Split(','); rowData.Select(sqlData, serviceCodes); totalRow.Accumulate(rowData); rowData.FillData(ws, rowIndex); }