Fixes
This commit is contained in:
@@ -13,6 +13,6 @@
|
||||
</providers>
|
||||
</entityFramework>
|
||||
<connectionStrings>
|
||||
<add name="LaboratoryDBEntities" connectionString="metadata=res://*/Models.Model1.csdl|res://*/Models.Model1.ssdl|res://*/Models.Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=PC311-11;initial catalog=LaboratoryDB;integrated security=True;trustservercertificate=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
|
||||
<add name="LaboratoryDBEntities" connectionString="metadata=res://*/Models.Model1.csdl|res://*/Models.Model1.ssdl|res://*/Models.Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=Room\SQLEXPRESS;initial catalog=LaboratoryDB;integrated security=True;trustservercertificate=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
|
||||
</connectionStrings>
|
||||
</configuration>
|
||||
@@ -84,10 +84,10 @@
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="Wpf.Ui, Version=4.2.0.0, Culture=neutral, PublicKeyToken=11f9f5cc97b3ffd6, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\WPF-UI.4.2.0\lib\net472\Wpf.Ui.dll</HintPath>
|
||||
<HintPath>..\packages\WPF-UI.4.2.1\lib\net472\Wpf.Ui.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Wpf.Ui.Abstractions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=11f9f5cc97b3ffd6, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\WPF-UI.Abstractions.4.2.0\lib\net462\Wpf.Ui.Abstractions.dll</HintPath>
|
||||
<HintPath>..\packages\WPF-UI.Abstractions.4.2.1\lib\net472\Wpf.Ui.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
<Property Name="LastLogin" Type="datetime" />
|
||||
<Property Name="IP" Type="nvarchar" MaxLength="50" />
|
||||
</EntityType>
|
||||
<Association Name="FK__Analyzer___Analy__5629CD9C">
|
||||
<Association Name="FK__Analyzer___Analy__5812160E">
|
||||
<End Role="Analyzers" Type="Self.Analyzers" Multiplicity="0..1" />
|
||||
<End Role="Analyzer_Logs" Type="Self.Analyzer_Logs" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
@@ -175,7 +175,7 @@
|
||||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
<Association Name="FK__Analyzer___Rende__571DF1D5">
|
||||
<Association Name="FK__Analyzer___Rende__59063A47">
|
||||
<End Role="Rendered_Services" Type="Self.Rendered_Services" Multiplicity="0..1" />
|
||||
<End Role="Analyzer_Logs" Type="Self.Analyzer_Logs" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
@@ -187,7 +187,7 @@
|
||||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
<Association Name="FK__Invoices__Accoun__5812160E">
|
||||
<Association Name="FK__Invoices__Accoun__59FA5E80">
|
||||
<End Role="Users" Type="Self.Users" Multiplicity="0..1" />
|
||||
<End Role="Invoices" Type="Self.Invoices" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
@@ -199,7 +199,7 @@
|
||||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
<Association Name="FK__Invoices__Compan__59063A47">
|
||||
<Association Name="FK__Invoices__Compan__5AEE82B9">
|
||||
<End Role="Insurance_Companies" Type="Self.Insurance_Companies" Multiplicity="0..1" />
|
||||
<End Role="Invoices" Type="Self.Invoices" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
@@ -211,7 +211,7 @@
|
||||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
<Association Name="FK__Invoices__OrderR__59FA5E80">
|
||||
<Association Name="FK__Invoices__OrderR__5BE2A6F2">
|
||||
<End Role="Orders" Type="Self.Orders" Multiplicity="0..1" />
|
||||
<End Role="Invoices" Type="Self.Invoices" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
@@ -223,7 +223,7 @@
|
||||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
<Association Name="FK__Order_Ite__Order__5AEE82B9">
|
||||
<Association Name="FK__Order_Ite__Order__5CD6CB2B">
|
||||
<End Role="Orders" Type="Self.Orders" Multiplicity="0..1" />
|
||||
<End Role="Order_Items" Type="Self.Order_Items" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
@@ -235,7 +235,7 @@
|
||||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
<Association Name="FK__Order_Ite__Servi__5BE2A6F2">
|
||||
<Association Name="FK__Order_Ite__Servi__5DCAEF64">
|
||||
<End Role="Services" Type="Self.Services" Multiplicity="0..1" />
|
||||
<End Role="Order_Items" Type="Self.Order_Items" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
@@ -247,7 +247,7 @@
|
||||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
<Association Name="FK__Order_Ite__Servi__5CD6CB2B">
|
||||
<Association Name="FK__Order_Ite__Servi__5EBF139D">
|
||||
<End Role="Service_Statuses" Type="Self.Service_Statuses" Multiplicity="0..1" />
|
||||
<End Role="Order_Items" Type="Self.Order_Items" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
@@ -259,7 +259,7 @@
|
||||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
<Association Name="FK__Orders__Patient__5DCAEF64">
|
||||
<Association Name="FK__Orders__Patient__5FB337D6">
|
||||
<End Role="Patients" Type="Self.Patients" Multiplicity="0..1" />
|
||||
<End Role="Orders" Type="Self.Orders" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
@@ -271,7 +271,7 @@
|
||||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
<Association Name="FK__Orders__Status__5EBF139D">
|
||||
<Association Name="FK__Orders__Status__60A75C0F">
|
||||
<End Role="Order_Statuses" Type="Self.Order_Statuses" Multiplicity="0..1" />
|
||||
<End Role="Orders" Type="Self.Orders" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
@@ -283,7 +283,7 @@
|
||||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
<Association Name="FK__Patients__Compan__5FB337D6">
|
||||
<Association Name="FK__Patients__Compan__619B8048">
|
||||
<End Role="Insurance_Companies" Type="Self.Insurance_Companies" Multiplicity="0..1" />
|
||||
<End Role="Patients" Type="Self.Patients" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
@@ -295,7 +295,7 @@
|
||||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
<Association Name="FK__Patients__Policy__60A75C0F">
|
||||
<Association Name="FK__Patients__Policy__628FA481">
|
||||
<End Role="Policy_Types" Type="Self.Policy_Types" Multiplicity="0..1" />
|
||||
<End Role="Patients" Type="Self.Patients" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
@@ -307,7 +307,7 @@
|
||||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
<Association Name="FK__Rendered___Analy__619B8048">
|
||||
<Association Name="FK__Rendered___Analy__6383C8BA">
|
||||
<End Role="Analyzers" Type="Self.Analyzers" Multiplicity="0..1" />
|
||||
<End Role="Rendered_Services" Type="Self.Rendered_Services" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
@@ -319,7 +319,7 @@
|
||||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
<Association Name="FK__Rendered___Labor__628FA481">
|
||||
<Association Name="FK__Rendered___Labor__6477ECF3">
|
||||
<End Role="Users" Type="Self.Users" Multiplicity="0..1" />
|
||||
<End Role="Rendered_Services" Type="Self.Rendered_Services" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
@@ -331,7 +331,7 @@
|
||||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
<Association Name="FK__Rendered___Order__6383C8BA">
|
||||
<Association Name="FK__Rendered___Order__656C112C">
|
||||
<End Role="Order_Items" Type="Self.Order_Items" Multiplicity="0..1" />
|
||||
<End Role="Rendered_Services" Type="Self.Rendered_Services" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
@@ -343,7 +343,7 @@
|
||||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
<Association Name="FK__User_Serv__ID_Se__6477ECF3">
|
||||
<Association Name="FK__User_Serv__ID_Se__66603565">
|
||||
<End Role="Services" Type="Self.Services" Multiplicity="1" />
|
||||
<End Role="User_Services" Type="Self.User_Services" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
@@ -355,7 +355,7 @@
|
||||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
<Association Name="FK__User_Serv__ID_Us__656C112C">
|
||||
<Association Name="FK__User_Serv__ID_Us__6754599E">
|
||||
<End Role="Users" Type="Self.Users" Multiplicity="1" />
|
||||
<End Role="User_Services" Type="Self.User_Services" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
@@ -367,7 +367,7 @@
|
||||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
<Association Name="FK__Users__Role__66603565">
|
||||
<Association Name="FK__Users__Role__68487DD7">
|
||||
<End Role="Roles" Type="Self.Roles" Multiplicity="0..1" />
|
||||
<End Role="Users" Type="Self.Users" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
@@ -396,75 +396,75 @@
|
||||
<EntitySet Name="Services" EntityType="Self.Services" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="User_Services" EntityType="Self.User_Services" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="Users" EntityType="Self.Users" Schema="dbo" store:Type="Tables" />
|
||||
<AssociationSet Name="FK__Analyzer___Analy__5629CD9C" Association="Self.FK__Analyzer___Analy__5629CD9C">
|
||||
<AssociationSet Name="FK__Analyzer___Analy__5812160E" Association="Self.FK__Analyzer___Analy__5812160E">
|
||||
<End Role="Analyzers" EntitySet="Analyzers" />
|
||||
<End Role="Analyzer_Logs" EntitySet="Analyzer_Logs" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK__Analyzer___Rende__571DF1D5" Association="Self.FK__Analyzer___Rende__571DF1D5">
|
||||
<AssociationSet Name="FK__Analyzer___Rende__59063A47" Association="Self.FK__Analyzer___Rende__59063A47">
|
||||
<End Role="Rendered_Services" EntitySet="Rendered_Services" />
|
||||
<End Role="Analyzer_Logs" EntitySet="Analyzer_Logs" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK__Invoices__Accoun__5812160E" Association="Self.FK__Invoices__Accoun__5812160E">
|
||||
<AssociationSet Name="FK__Invoices__Accoun__59FA5E80" Association="Self.FK__Invoices__Accoun__59FA5E80">
|
||||
<End Role="Users" EntitySet="Users" />
|
||||
<End Role="Invoices" EntitySet="Invoices" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK__Invoices__Compan__59063A47" Association="Self.FK__Invoices__Compan__59063A47">
|
||||
<AssociationSet Name="FK__Invoices__Compan__5AEE82B9" Association="Self.FK__Invoices__Compan__5AEE82B9">
|
||||
<End Role="Insurance_Companies" EntitySet="Insurance_Companies" />
|
||||
<End Role="Invoices" EntitySet="Invoices" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK__Invoices__OrderR__59FA5E80" Association="Self.FK__Invoices__OrderR__59FA5E80">
|
||||
<AssociationSet Name="FK__Invoices__OrderR__5BE2A6F2" Association="Self.FK__Invoices__OrderR__5BE2A6F2">
|
||||
<End Role="Orders" EntitySet="Orders" />
|
||||
<End Role="Invoices" EntitySet="Invoices" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK__Order_Ite__Order__5AEE82B9" Association="Self.FK__Order_Ite__Order__5AEE82B9">
|
||||
<AssociationSet Name="FK__Order_Ite__Order__5CD6CB2B" Association="Self.FK__Order_Ite__Order__5CD6CB2B">
|
||||
<End Role="Orders" EntitySet="Orders" />
|
||||
<End Role="Order_Items" EntitySet="Order_Items" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK__Order_Ite__Servi__5BE2A6F2" Association="Self.FK__Order_Ite__Servi__5BE2A6F2">
|
||||
<AssociationSet Name="FK__Order_Ite__Servi__5DCAEF64" Association="Self.FK__Order_Ite__Servi__5DCAEF64">
|
||||
<End Role="Services" EntitySet="Services" />
|
||||
<End Role="Order_Items" EntitySet="Order_Items" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK__Order_Ite__Servi__5CD6CB2B" Association="Self.FK__Order_Ite__Servi__5CD6CB2B">
|
||||
<AssociationSet Name="FK__Order_Ite__Servi__5EBF139D" Association="Self.FK__Order_Ite__Servi__5EBF139D">
|
||||
<End Role="Service_Statuses" EntitySet="Service_Statuses" />
|
||||
<End Role="Order_Items" EntitySet="Order_Items" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK__Orders__Patient__5DCAEF64" Association="Self.FK__Orders__Patient__5DCAEF64">
|
||||
<AssociationSet Name="FK__Orders__Patient__5FB337D6" Association="Self.FK__Orders__Patient__5FB337D6">
|
||||
<End Role="Patients" EntitySet="Patients" />
|
||||
<End Role="Orders" EntitySet="Orders" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK__Orders__Status__5EBF139D" Association="Self.FK__Orders__Status__5EBF139D">
|
||||
<AssociationSet Name="FK__Orders__Status__60A75C0F" Association="Self.FK__Orders__Status__60A75C0F">
|
||||
<End Role="Order_Statuses" EntitySet="Order_Statuses" />
|
||||
<End Role="Orders" EntitySet="Orders" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK__Patients__Compan__5FB337D6" Association="Self.FK__Patients__Compan__5FB337D6">
|
||||
<AssociationSet Name="FK__Patients__Compan__619B8048" Association="Self.FK__Patients__Compan__619B8048">
|
||||
<End Role="Insurance_Companies" EntitySet="Insurance_Companies" />
|
||||
<End Role="Patients" EntitySet="Patients" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK__Patients__Policy__60A75C0F" Association="Self.FK__Patients__Policy__60A75C0F">
|
||||
<AssociationSet Name="FK__Patients__Policy__628FA481" Association="Self.FK__Patients__Policy__628FA481">
|
||||
<End Role="Policy_Types" EntitySet="Policy_Types" />
|
||||
<End Role="Patients" EntitySet="Patients" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK__Rendered___Analy__619B8048" Association="Self.FK__Rendered___Analy__619B8048">
|
||||
<AssociationSet Name="FK__Rendered___Analy__6383C8BA" Association="Self.FK__Rendered___Analy__6383C8BA">
|
||||
<End Role="Analyzers" EntitySet="Analyzers" />
|
||||
<End Role="Rendered_Services" EntitySet="Rendered_Services" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK__Rendered___Labor__628FA481" Association="Self.FK__Rendered___Labor__628FA481">
|
||||
<AssociationSet Name="FK__Rendered___Labor__6477ECF3" Association="Self.FK__Rendered___Labor__6477ECF3">
|
||||
<End Role="Users" EntitySet="Users" />
|
||||
<End Role="Rendered_Services" EntitySet="Rendered_Services" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK__Rendered___Order__6383C8BA" Association="Self.FK__Rendered___Order__6383C8BA">
|
||||
<AssociationSet Name="FK__Rendered___Order__656C112C" Association="Self.FK__Rendered___Order__656C112C">
|
||||
<End Role="Order_Items" EntitySet="Order_Items" />
|
||||
<End Role="Rendered_Services" EntitySet="Rendered_Services" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK__User_Serv__ID_Se__6477ECF3" Association="Self.FK__User_Serv__ID_Se__6477ECF3">
|
||||
<AssociationSet Name="FK__User_Serv__ID_Se__66603565" Association="Self.FK__User_Serv__ID_Se__66603565">
|
||||
<End Role="Services" EntitySet="Services" />
|
||||
<End Role="User_Services" EntitySet="User_Services" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK__User_Serv__ID_Us__656C112C" Association="Self.FK__User_Serv__ID_Us__656C112C">
|
||||
<AssociationSet Name="FK__User_Serv__ID_Us__6754599E" Association="Self.FK__User_Serv__ID_Us__6754599E">
|
||||
<End Role="Users" EntitySet="Users" />
|
||||
<End Role="User_Services" EntitySet="User_Services" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK__Users__Role__66603565" Association="Self.FK__Users__Role__66603565">
|
||||
<AssociationSet Name="FK__Users__Role__68487DD7" Association="Self.FK__Users__Role__68487DD7">
|
||||
<End Role="Roles" EntitySet="Roles" />
|
||||
<End Role="Users" EntitySet="Users" />
|
||||
</AssociationSet>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
|
||||
<!-- Diagram content (shape and connector positions) -->
|
||||
<edmx:Diagrams>
|
||||
<Diagram DiagramId="8b20e28e629f4a2e8c7ec2d447e9f647" Name="Diagram1">
|
||||
<Diagram DiagramId="8b20e28e629f4a2e8c7ec2d447e9f647" Name="Diagram1" ZoomLevel="64">
|
||||
<EntityTypeShape EntityType="LaboratoryDBModel.Analyzer_Logs" Width="1.5" PointX="13.5" PointY="4.5" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="LaboratoryDBModel.Analyzer" Width="1.5" PointX="6" PointY="0.75" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="LaboratoryDBModel.Insurance_Companies" Width="1.5" PointX="1.5" PointY="21.625" IsExpanded="true" />
|
||||
|
||||
2
Labaratory/Labaratory/Models/Model11.Designer.cs
generated
2
Labaratory/Labaratory/Models/Model11.Designer.cs
generated
@@ -1,4 +1,4 @@
|
||||
// Создание кода T4 для модели "C:\Users\usersql\Source\Repos\UP01TASK3\Labaratory\Labaratory\Models\Model1.edmx" включено.
|
||||
// Создание кода T4 для модели "D:\Projects\TASK3UP01\Labaratory\Labaratory\Models\Model1.edmx" включено.
|
||||
// Чтобы включить формирование кода прежних версий, измените значение свойства "Стратегия создания кода" конструктора
|
||||
// на "Legacy ObjectContext". Это свойство доступно в окне "Свойства", если модель
|
||||
// открыта в конструкторе.
|
||||
|
||||
@@ -1,18 +1,109 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Labaratory.Models;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Data.Entity; // Для .Include() в старых версиях EF
|
||||
using Wpf.Ui.Input;
|
||||
|
||||
namespace Labaratory.ViewModels
|
||||
{
|
||||
public class ByhalterModel : BaseViewModel
|
||||
{
|
||||
public Models.User CurrentUser { get; set; }
|
||||
private readonly LaboratoryDBEntities _db;
|
||||
public string RoleName => "Бухгалтер";
|
||||
|
||||
private Models.User _currentUser;
|
||||
public Models.User CurrentUser
|
||||
{
|
||||
get => _currentUser;
|
||||
set
|
||||
{
|
||||
_currentUser = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<Invoice> Invoices { get; set; }
|
||||
public ObservableCollection<Insurance_Companies> InsuranceCompanies { get; set; }
|
||||
public ObservableCollection<Rendered_Services> Reports { get; set; }
|
||||
|
||||
private Insurance_Companies _selectedCompany;
|
||||
public Insurance_Companies SelectedCompany
|
||||
{
|
||||
get => _selectedCompany;
|
||||
set
|
||||
{
|
||||
_selectedCompany = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
public ICommand GenerateRevenueReportCommand { get; }
|
||||
public ICommand CreateInvoiceCommand { get; }
|
||||
|
||||
public ByhalterModel(Models.User user)
|
||||
{
|
||||
CurrentUser = user;
|
||||
_db = new LaboratoryDBEntities(); // Используем ваш контекст
|
||||
|
||||
LoadInitialData();
|
||||
|
||||
GenerateRevenueReportCommand = new RelayCommand<object>(_ => GenerateRevenueReport());
|
||||
CreateInvoiceCommand = new RelayCommand<object>(_ => CreateInvoice());
|
||||
}
|
||||
|
||||
private void LoadInitialData()
|
||||
{
|
||||
InsuranceCompanies = new ObservableCollection<Insurance_Companies>(_db.Insurance_Companies.ToList());
|
||||
Invoices = new ObservableCollection<Invoice>(_db.Invoices.Include(i => i.Insurance_Companies).ToList());
|
||||
Reports = new ObservableCollection<Rendered_Services>();
|
||||
}
|
||||
|
||||
private void GenerateRevenueReport()
|
||||
{
|
||||
var data = _db.Rendered_Services
|
||||
.Include(s => s.OrderItem)
|
||||
.OrderByDescending(s => s.ExecutionDate)
|
||||
.ToList();
|
||||
|
||||
Reports.Clear();
|
||||
foreach (var item in data) Reports.Add(item);
|
||||
}
|
||||
|
||||
private void CreateInvoice()
|
||||
{
|
||||
if (SelectedCompany == null)
|
||||
{
|
||||
MessageBox.Show("Выберите страховую компанию!");
|
||||
return;
|
||||
}
|
||||
|
||||
decimal totalAmount = (decimal)(_db.Orders
|
||||
.Where(o => o.Patient1.Company == SelectedCompany.ID_Company)
|
||||
.SelectMany(o => o.Order_Items)
|
||||
.Sum(oi => (double?)oi.Service1.Price) ?? 0);
|
||||
|
||||
var newInvoice = new Invoice
|
||||
{
|
||||
InvoiceNumber = "INV-" + DateTime.Now.Ticks.ToString().Substring(10),
|
||||
Accountant = CurrentUser.ID_User,
|
||||
Company = SelectedCompany.ID_Company,
|
||||
IssueDate = DateTime.Now,
|
||||
Amount = totalAmount
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
_db.Invoices.Add(newInvoice);
|
||||
_db.SaveChanges();
|
||||
Invoices.Add(newInvoice);
|
||||
MessageBox.Show($"Счет сформирован! Сумма: {totalAmount:C}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"Ошибка сохранения: {ex.InnerException?.Message ?? ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ namespace Labaratory.ViewModels
|
||||
CalculateNextNumber();
|
||||
StartTimer();
|
||||
ProcessOrderCommand = new RelayCommand<object>(execute => ProcessOrder());
|
||||
|
||||
}
|
||||
private string _barcodeInput;
|
||||
private string _suggestedNumber;
|
||||
@@ -58,7 +59,6 @@ namespace Labaratory.ViewModels
|
||||
set;
|
||||
} = new ObservableCollection<Models.Service>();
|
||||
|
||||
|
||||
public decimal TotalCost
|
||||
{
|
||||
get => _totalCost;
|
||||
@@ -88,7 +88,6 @@ namespace Labaratory.ViewModels
|
||||
_timer.Tick += Timer_Tick;
|
||||
_timer.Start();
|
||||
}
|
||||
|
||||
private void Timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (_timeSpan.TotalSeconds > 0)
|
||||
@@ -139,7 +138,6 @@ namespace Labaratory.ViewModels
|
||||
SaveToPdf(fullCode);
|
||||
SaveOrderToDb(fullCode);
|
||||
}
|
||||
|
||||
private string GenerateFullBarcode(string orderId)
|
||||
{
|
||||
string datePart = DateTime.Now.ToString("ddMMyyyy");
|
||||
@@ -174,7 +172,6 @@ namespace Labaratory.ViewModels
|
||||
MessageBox.Show($"Ошибка при сохранении в БД: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveToPdf(string fullCode)
|
||||
{
|
||||
string filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), $"Barcode_{fullCode}.pdf");
|
||||
@@ -231,7 +228,6 @@ namespace Labaratory.ViewModels
|
||||
MessageBox.Show("Ошибка PDF: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawGuardBar(PdfContentByte cb, float x, float y, float height, float mmToPt)
|
||||
{
|
||||
cb.Rectangle(x, y, 0.15f * mmToPt, height * mmToPt);
|
||||
@@ -255,12 +251,10 @@ namespace Labaratory.ViewModels
|
||||
string surname = parts[0];
|
||||
string firstName = parts.Length > 1 ? parts[1] : "";
|
||||
|
||||
// 1. Ищем в БД
|
||||
var patient = db.Patients.FirstOrDefault(p => p.Surname == surname && p.FirstName == firstName);
|
||||
|
||||
if (patient == null)
|
||||
{
|
||||
// 2. Если не нашли — открываем модальное окно
|
||||
var addWin = new Views.AddPatientWindow();
|
||||
var vm = new AddPatientViewModel { Surname = surname, FirstName = firstName };
|
||||
addWin.DataContext = vm;
|
||||
@@ -281,26 +275,5 @@ namespace Labaratory.ViewModels
|
||||
TotalCost = SelectedServices.Sum(s => s.Price);
|
||||
OnPropertyChanged(nameof(TotalCost));
|
||||
}
|
||||
|
||||
private void CheckAndAddPatient(string searchSurname, string searchName)
|
||||
{
|
||||
var patient = db.Patients.FirstOrDefault(p => p.Surname == searchSurname && p.FirstName == searchName);
|
||||
|
||||
if (patient == null)
|
||||
{
|
||||
var addWin = new AddPatientWindow();
|
||||
var vm = new AddPatientViewModel { Surname = searchSurname, FirstName = searchName };
|
||||
addWin.DataContext = vm;
|
||||
|
||||
if (addWin.ShowDialog() == true)
|
||||
{
|
||||
SelectedPatient = vm.SavedPatient;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedPatient = patient;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel>
|
||||
<!-- Личные данные -->
|
||||
|
||||
<ui:TextBox Text="{Binding Surname}" PlaceholderText="Фамилия*" Margin="0,5" />
|
||||
<ui:TextBox Text="{Binding FirstName}" PlaceholderText="Имя*" Margin="0,5" />
|
||||
<ui:TextBox Text="{Binding Patronymic}" PlaceholderText="Отчество" Margin="0,5" />
|
||||
@@ -27,13 +27,11 @@
|
||||
|
||||
<Separator Margin="0,10" />
|
||||
|
||||
<!-- Контакты -->
|
||||
<ui:TextBox Text="{Binding Phone}" PlaceholderText="Телефон (+7...)" Margin="0,5" />
|
||||
<ui:TextBox Text="{Binding Phone}" PlaceholderText="Телефон" Margin="0,5" MaxLength="11"/>
|
||||
<ui:TextBox Text="{Binding Email}" PlaceholderText="E-mail" Margin="0,5" />
|
||||
|
||||
<Separator Margin="0,10" />
|
||||
|
||||
<!-- Паспортные данные -->
|
||||
<Grid Margin="0,5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
@@ -45,7 +43,6 @@
|
||||
|
||||
<Separator Margin="0,10" />
|
||||
|
||||
<!-- Страхование -->
|
||||
<ui:TextBox Text="{Binding InsuranceNumber}" PlaceholderText="Номер полиса" Margin="0,5" />
|
||||
|
||||
<TextBlock Text="Тип полиса" Margin="0,5,0,0" FontSize="12" Foreground="Gray" />
|
||||
|
||||
@@ -1,12 +1,82 @@
|
||||
<Window x:Class="Labaratory.Views.ByhalterWindow"
|
||||
<Window x:Class="Labaratory.Views.Laborant"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:Labaratory.Views"
|
||||
mc:Ignorable="d"
|
||||
Title="ByhalterWindow" Height="450" Width="800">
|
||||
<Grid>
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:services="clr-namespace:Labaratory.Services"
|
||||
Title="Рабочее бугхалтера" Height="700" Width="900"
|
||||
Background="{ui:ThemeResource ApplicationBackgroundBrush}"
|
||||
Foreground="{ui:ThemeResource TextFillColorPrimaryBrush}">
|
||||
|
||||
<Window.Resources>
|
||||
<services:StringToImageConverter x:Key="StringToImageConverter" />
|
||||
</Window.Resources>
|
||||
|
||||
<Grid>
|
||||
<TabControl Margin="0">
|
||||
|
||||
<TabItem Header="Профиль">
|
||||
<Grid VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<ui:Card Padding="30">
|
||||
<StackPanel>
|
||||
<Ellipse Width="150" Height="150" Stroke="{ui:ThemeResource SystemAccentColorPrimaryBrush}" StrokeThickness="2">
|
||||
<Ellipse.Fill>
|
||||
<ImageBrush ImageSource="/Images/Buhalter.jpeg"
|
||||
Stretch="UniformToFill"/>
|
||||
</Ellipse.Fill>
|
||||
</Ellipse>
|
||||
|
||||
<TextBlock Text="{Binding CurrentUser.FirstName}" FontSize="20" HorizontalAlignment="Center" Margin="0,15,0,0"/>
|
||||
<TextBlock Text="{Binding CurrentUser.Surname}" FontSize="24" HorizontalAlignment="Center" FontWeight="Bold"/>
|
||||
<TextBlock Text="{Binding RoleName}" Foreground="Gray" HorizontalAlignment="Center" Margin="0,5,0,0"/>
|
||||
</StackPanel>
|
||||
</ui:Card>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Отчеты">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,20">
|
||||
<ui:Button Content="Сформировать отчет по выручке" Icon="DocumentData24" Command="{Binding GenerateRevenueReportCommand}" Margin="0,0,10,0"/>
|
||||
<ui:Button Content="Экспорт в PDF" Icon="Print24" Command="{Binding ExportReportCommand}"/>
|
||||
</StackPanel>
|
||||
<ui:DataGrid Grid.Row="1" ItemsSource="{Binding Reports}" AutoGenerateColumns="True" IsReadOnly="True"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Счета страховым компаниям">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Margin="0,0,0,20">
|
||||
<TextBlock Text="Формирование нового счета" FontSize="18" FontWeight="SemiBold" Margin="0,0,0,10"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ComboBox ItemsSource="{Binding InsuranceCompanies}" DisplayMemberPath="Name" SelectedItem="{Binding SelectedCompany}" Width="250"/>
|
||||
<ui:Button Content="Создать счет" Icon="Add24" Command="{Binding CreateInvoiceCommand}" Margin="10,0,0,0" Appearance="Primary"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<ui:DataGrid Grid.Row="1" ItemsSource="{Binding Invoices}" AutoGenerateColumns="False">
|
||||
<ui:DataGrid.Columns>
|
||||
<DataGridTextColumn Header="№ Счета" Binding="{Binding Id}"/>
|
||||
<DataGridTextColumn Header="Компания" Binding="{Binding CompanyName}"/>
|
||||
<DataGridTextColumn Header="Дата" Binding="{Binding Date, StringFormat=d}"/>
|
||||
<DataGridTextColumn Header="Сумма" Binding="{Binding TotalAmount, StringFormat=C}"/>
|
||||
<DataGridTemplateColumn Header="Действие">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ui:Button Content="Скачать" Icon="ArrowDownload24" Command="{Binding DataContext.DownloadInvoiceCommand, RelativeSource={RelativeSource AncestorType=ui:DataGrid}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</ui:DataGrid.Columns>
|
||||
</ui:DataGrid>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -12,9 +12,9 @@
|
||||
</Window.Resources>
|
||||
|
||||
<Grid>
|
||||
<Label HorizontalAlignment="Left" VerticalAlignment="Top" Content="{Binding Time}" Height="22" Width="72"/>
|
||||
<Label HorizontalAlignment="Left" VerticalAlignment="Top" Content="{Binding Time}" Height="22" Width="100"/>
|
||||
<TabControl Margin="0,42,0,0">
|
||||
<!-- ВКЛАДКА 1: ОФОРМЛЕНИЕ -->
|
||||
|
||||
<TabItem Header="Новый заказ">
|
||||
<Grid Margin="20">
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -23,7 +23,7 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel Grid.Column="0" Margin="0,0,15,0">
|
||||
<!-- Блок пациента -->
|
||||
|
||||
<ui:Card Margin="0,0,0,10">
|
||||
<StackPanel Margin="5">
|
||||
<TextBlock Text="Поиск пациента" FontWeight="Bold" Margin="0,0,0,5"/>
|
||||
@@ -39,7 +39,7 @@
|
||||
Margin="5,0,0,0" />
|
||||
</Grid>
|
||||
|
||||
<!-- Детальные данные пациента после выбора -->
|
||||
|
||||
<StackPanel Margin="0,10,0,0">
|
||||
<TextBlock>
|
||||
<Run Text="Пациент: " Foreground="Gray"/>
|
||||
@@ -55,7 +55,6 @@
|
||||
</StackPanel>
|
||||
</ui:Card>
|
||||
|
||||
<!-- Блок услуг -->
|
||||
<ui:Card>
|
||||
<StackPanel>
|
||||
<TextBlock Text="Выбор услуг" FontSize="16" FontWeight="SemiBold" Margin="0,0,0,10" />
|
||||
@@ -84,7 +83,6 @@
|
||||
</ui:Card>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Правая часть: Итог -->
|
||||
<StackPanel Grid.Column="1">
|
||||
<ui:Card>
|
||||
<StackPanel>
|
||||
@@ -104,30 +102,6 @@
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<!-- ВКЛАДКА 2: ИСТОРИЯ ЗАКАЗОВ -->
|
||||
<TabItem Header="Список заказов">
|
||||
<Grid Margin="10">
|
||||
<DataGrid ItemsSource="{Binding AllOrders}" AutoGenerateColumns="False" IsReadOnly="True">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="ID" Binding="{Binding ID_Order}" Width="50"/>
|
||||
<DataGridTextColumn Header="Дата" Binding="{Binding OrderDate, StringFormat='dd.MM.yyyy HH:mm'}" Width="130"/>
|
||||
<DataGridTemplateColumn Header="Пациент" Width="*">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock>
|
||||
<Run Text="{Binding Patient.Surname}"/>
|
||||
<Run Text="{Binding Patient.FirstName}"/>
|
||||
</TextBlock>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Header="Штрих-код" Binding="{Binding Barcode}" Width="150"/>
|
||||
<DataGridTextColumn Header="Статус" Binding="{Binding OrderStatus.StatusName}" Width="120"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Профиль">
|
||||
<Grid VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<ui:Card Padding="30">
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
<package id="System.Memory" version="4.6.3" targetFramework="net472" />
|
||||
<package id="System.Numerics.Vectors" version="4.6.1" targetFramework="net472" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.2" targetFramework="net472" />
|
||||
<package id="WPF-UI" version="4.2.0" targetFramework="net472" />
|
||||
<package id="WPF-UI.Abstractions" version="4.2.0" targetFramework="net472" />
|
||||
<package id="WPF-UI" version="4.2.1" targetFramework="net472" />
|
||||
<package id="WPF-UI.Abstractions" version="4.2.1" targetFramework="net472" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user