115 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
		
		
			
		
	
	
			115 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| 
								 | 
							
								@page "/take/invoice"
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								<div class="container-fluid">
							 | 
						|||
| 
								 | 
							
								    <div class="row">
							 | 
						|||
| 
								 | 
							
								        <div class="col-12 mb-4">
							 | 
						|||
| 
								 | 
							
								            
							 | 
						|||
| 
								 | 
							
								            <form onsubmit="@(() => grid.Reload())">
							 | 
						|||
| 
								 | 
							
								                <RadzenFieldset Text="<22><>ѯ">
							 | 
						|||
| 
								 | 
							
								                    <RadzenStack Orientation="Orientation.Horizontal" Gap="1rem">
							 | 
						|||
| 
								 | 
							
								                        <RadzenRow AlignItems="AlignItems.Center">
							 | 
						|||
| 
								 | 
							
								                            <RadzenColumn Size="4">
							 | 
						|||
| 
								 | 
							
								                                <RadzenLabel Text="<22><><EFBFBD>ݺ<EFBFBD>" Component="InvoiceNo" />
							 | 
						|||
| 
								 | 
							
								                            </RadzenColumn>
							 | 
						|||
| 
								 | 
							
								                            <RadzenColumn Size="8">
							 | 
						|||
| 
								 | 
							
								                                <RadzenTextBox @bind-Value="InvoiceNo" Style="width: 100%;" Name="InvoiceNo"></RadzenTextBox>
							 | 
						|||
| 
								 | 
							
								                            </RadzenColumn>
							 | 
						|||
| 
								 | 
							
								                        </RadzenRow>
							 | 
						|||
| 
								 | 
							
								                        <RadzenRow AlignItems="AlignItems.Center">
							 | 
						|||
| 
								 | 
							
								                            <RadzenColumn Size="4">
							 | 
						|||
| 
								 | 
							
								                                <RadzenLabel Text="<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" Component="InvoiceDate" />
							 | 
						|||
| 
								 | 
							
								                            </RadzenColumn>
							 | 
						|||
| 
								 | 
							
								                            <RadzenColumn Size="8">
							 | 
						|||
| 
								 | 
							
								                                <RadzenDatePicker DateFormat="yyyy-MM-dd" CurrentDateChanged="@OnCurrentDateChanged" @bind-Value="InvoiceDate" Style="width: 100%;" Name="InvoiceDate" />
							 | 
						|||
| 
								 | 
							
								                            </RadzenColumn>
							 | 
						|||
| 
								 | 
							
								                        </RadzenRow>
							 | 
						|||
| 
								 | 
							
								                    
							 | 
						|||
| 
								 | 
							
								                        <RadzenRow AlignItems="AlignItems.Center">
							 | 
						|||
| 
								 | 
							
								                            <RadzenColumn Size="12">
							 | 
						|||
| 
								 | 
							
								                                <RadzenButton Size="ButtonSize.Medium" ButtonType="ButtonType.Submit" IsBusy="isLoading" Icon="search"  Text="<22><>ѯ" />
							 | 
						|||
| 
								 | 
							
								                                <RadzenButton Size="ButtonSize.Medium" Click="reloadGrid" IsBusy="isLoading" Icon="refresh" Text="<22><><EFBFBD><EFBFBD>" ButtonStyle="ButtonStyle.Warning" />
							 | 
						|||
| 
								 | 
							
								                            </RadzenColumn>
							 | 
						|||
| 
								 | 
							
								                        </RadzenRow>
							 | 
						|||
| 
								 | 
							
								                    </RadzenStack>
							 | 
						|||
| 
								 | 
							
								                </RadzenFieldset>
							 | 
						|||
| 
								 | 
							
								            </form>
							 | 
						|||
| 
								 | 
							
								        </div>
							 | 
						|||
| 
								 | 
							
								        <div class="col-12 mb-4">
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                <RadzenDataGrid @ref="grid"
							 | 
						|||
| 
								 | 
							
								                    LoadData="@LoadData"
							 | 
						|||
| 
								 | 
							
								                    RowSelect="@((InOutInvoice oi) => { InvoiceSelected(oi); })"
							 | 
						|||
| 
								 | 
							
								                    IsLoading="@isLoading"
							 | 
						|||
| 
								 | 
							
								                    Count="@count"
							 | 
						|||
| 
								 | 
							
								                    EmptyText="<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
							 | 
						|||
| 
								 | 
							
								                    Data="@_forecasts"
							 | 
						|||
| 
								 | 
							
								                    AllowColumnResize="true" AllowAlternatingRows="false"
							 | 
						|||
| 
								 | 
							
								                    SelectionMode="DataGridSelectionMode.Single"
							 | 
						|||
| 
								 | 
							
								                    AllowPaging="true" PageSize="10" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} <20><>{2}<7D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>">
							 | 
						|||
| 
								 | 
							
								                    <Columns>
							 | 
						|||
| 
								 | 
							
								                        <RadzenDataGridColumn Frozen="true" Title="<22><><EFBFBD>ݺ<EFBFBD>" Property="InvoiceNo"></RadzenDataGridColumn>
							 | 
						|||
| 
								 | 
							
								                        <RadzenDataGridColumn Width="170px" Title="ʱ<><CAB1>" Property="InvoiceDate"></RadzenDataGridColumn>
							 | 
						|||
| 
								 | 
							
								                        <RadzenDataGridColumn Title="<22><><EFBFBD><EFBFBD>ҩ<EFBFBD><D2A9>" Property="InPharmacyId"></RadzenDataGridColumn>
							 | 
						|||
| 
								 | 
							
								                        <RadzenDataGridColumn Title="<22><><EFBFBD><EFBFBD>ҩ<EFBFBD><D2A9>" Property="OutPharmacyId"></RadzenDataGridColumn>
							 | 
						|||
| 
								 | 
							
								                    </Columns>
							 | 
						|||
| 
								 | 
							
								                </RadzenDataGrid>
							 | 
						|||
| 
								 | 
							
								        </div>
							 | 
						|||
| 
								 | 
							
								    </div>
							 | 
						|||
| 
								 | 
							
								</div>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								@code {
							 | 
						|||
| 
								 | 
							
								    @inject IInOutInvoiceDao inOutInvoiceDao;
							 | 
						|||
| 
								 | 
							
								    @inject DialogService dialogService;
							 | 
						|||
| 
								 | 
							
								    RadzenDataGrid<InOutInvoice> grid;
							 | 
						|||
| 
								 | 
							
								    bool isLoading;
							 | 
						|||
| 
								 | 
							
								    int count;
							 | 
						|||
| 
								 | 
							
								    private IEnumerable<InOutInvoice>? _forecasts;
							 | 
						|||
| 
								 | 
							
								    string InvoiceNo;
							 | 
						|||
| 
								 | 
							
								    DateTime InvoiceDate = DateTime.MinValue;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    void OnCurrentDateChanged(DateTime args)
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        InvoiceDate = new DateTime(args.Year, args.Month, args.Day);
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    async Task LoadData(LoadDataArgs args)
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        isLoading = true;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        var result = await inOutInvoiceDao.GetAllInvoiceByType(InvoiceNo, InvoiceDate, args.Top, args.Skip, 2);
							 | 
						|||
| 
								 | 
							
								        // Update the Data property
							 | 
						|||
| 
								 | 
							
								        _forecasts = result.Desserts;
							 | 
						|||
| 
								 | 
							
								        // Update the count
							 | 
						|||
| 
								 | 
							
								        count = result.TotalDesserts;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        isLoading = false;
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    async Task reloadGrid()
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        InvoiceNo = "";
							 | 
						|||
| 
								 | 
							
								        InvoiceDate = DateTime.MinValue;
							 | 
						|||
| 
								 | 
							
								        await grid.Reload();
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    async Task InvoiceSelected(InOutInvoice oi)
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        var b = await dialogService.OpenAsync<InvoiceOutDialog>(
							 | 
						|||
| 
								 | 
							
								                $"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
							 | 
						|||
| 
								 | 
							
								              new Dictionary<string, object>() { { "invoice", oi } },
							 | 
						|||
| 
								 | 
							
								              new DialogOptions() { Width = "85vw", Resizable = true, Draggable = true, ShowClose = false }
							 | 
						|||
| 
								 | 
							
								        );
							 | 
						|||
| 
								 | 
							
								        if (b)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            await reloadGrid();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								}
							 |