Skip to content

Commit

Permalink
Translate
Browse files Browse the repository at this point in the history
  • Loading branch information
DitriXNew committed Feb 29, 2024
1 parent 905a596 commit 445da2e
Show file tree
Hide file tree
Showing 25 changed files with 3,038 additions and 76 deletions.
1,577 changes: 1,577 additions & 0 deletions IRP/src/CommonForms/PaymentByDocuments/Form.form

Large diffs are not rendered by default.

216 changes: 216 additions & 0 deletions IRP/src/CommonForms/PaymentByDocuments/Module.bsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@

&AtServer
Procedure OnCreateAtServer(Cancel, StandardProcessing)
ThisObject.RegisterName = Parameters.RegisterName;
ThisObject.DocRef = Parameters.Ref;
ThisObject.Company = Parameters.Company;
ThisObject.Branch = Parameters.Branch;
ThisObject.Currency = Parameters.Currency;
For Each Row In Parameters.SelectedDocuments Do
NewRow = ThisObject.SelectedDocuments.Add();
NewRow.Document = Row;
EndDo;

For Each Row In Parameters.AllowedTypes Do
NewRow = ThisObject.AllowedTypes.Add();
NewRow.Type = Row;
EndDo;
FillTable();
EndProcedure

&AtClient
Procedure FilterPartnerOnChange(Item)
FillTable();
EndProcedure

&AtServer
Procedure FillTable()
Query = New Query();
Query.Text =
"SELECT ALLOWED
| TransactionsBalance.Basis AS Document,
| TransactionsBalance.Basis.Partner AS Partner,
| TransactionsBalance.Basis.Agreement AS Agreement,
| TransactionsBalance.AmountBalance AS Amount,
| TransactionsBalance.Order,
| TransactionsBalance.Project,
| TransactionsBalance.Basis.LegalName AS LegalName,
| TransactionsBalance.Basis.LegalNameContract AS LegalNameContract,
| TransactionsBalance.Basis.Date AS DocDate
|FROM
| AccumulationRegister.R1021B_VendorsTransactions.Balance(&Boundary, Company = &Company
| AND Branch = &Branch
| AND Currency = &Currency
| AND CurrencyMovementType = VALUE(ChartOfCharacteristicTypes.CurrencyMovementType.SettlementCurrency)
| AND VALUETYPE(Basis) IN (&AllowedTypes)
| AND CASE
| WHEN &Filter_Partner
| THEN Partner = &Partner
| ELSE TRUE
| END) AS TransactionsBalance
|WHERE
| TransactionsBalance.AmountBalance > 0
| AND NOT TransactionsBalance.Basis.Ref IS NULL
| AND NOT TransactionsBalance.Basis IN (&SelectedDocuments)
|
|ORDER BY
| TransactionsBalance.Basis.Date";

Query.Text = StrReplace(Query.Text, "R1021B_VendorsTransactions", ThisObject.RegisterName);

If ValueIsFilled(ThisObject.DocRef) Then
Query.SetParameter("Boundary", New Boundary(ThisObject.DocRef.PointInTime(), BoundaryType.Excluding));
Else
Query.SetParameter("Boundary", CommonFunctionsServer.GetCurrentSessionDate());
EndIf;

ArrayOfAllowedTypes = New Array();
For Each Row In ThisObject.AllowedTypes Do
ArrayOfAllowedTypes.Add(Row.Type);
EndDo;

ArrayOfSelectedDocuments = New Array();
For Each Row In ThisObject.SelectedDocuments Do
ArrayOfSelectedDocuments.Add(Row.Document);
EndDo;

Query.SetParameter("Company" , ThisObject.Company);
Query.SetParameter("Branch" , ThisObject.Branch);
Query.SetParameter("Currency" , ThisObject.Currency);
Query.SetParameter("AllowedTypes" , ArrayOfAllowedTypes);
Query.SetParameter("SelectedDocuments" , ArrayOfSelectedDocuments);
Query.SetParameter("Filter_Partner" , ValueIsFilled(ThisObject.FilterPartner));
Query.SetParameter("Partner" , ThisObject.FilterPartner);

QueryResult = Query.Execute();
ThisObject.Documents.Load(QueryResult.Unload());
For Each Row In ThisObject.Documents Do
Row.RowKey = String(New UUID());
EndDo;
EndProcedure

&AtClient
Procedure Ok(Command)
If Not CheckFilling() Then
Return;
EndIf;

Result = CalculateRows();
Close(Result);
EndProcedure

&AtClient
Procedure Calculate(Command)
CalculateRows();
EndProcedure

&AtClient
Function CalculateRows()
For Each Row In ThisObject.Documents Do
Row.Payment = 0;
EndDo;

ArrayOfRows = New Array();

If Items.Documents.SelectedRows.Count() > 1 Then
For Each SelectedRow In Items.Documents.SelectedRows Do
NewRow = GetEmptyRowTable();
FillPropertyValues(NewRow, ThisObject.Documents.FindByID(SelectedRow));
ArrayOfRows.Add(NewRow);
EndDo;
Else
For Each Row In ThisObject.Documents Do
NewRow = GetEmptyRowTable();
FillPropertyValues(NewRow, Row);
ArrayOfRows.Add(NewRow);
EndDo;
EndIf;

ArrayOfRows = SortRowsByDate(ArrayOfRows);

Result = New Array();

_Amount = ThisObject.Amount;
For Each Row In ArrayOfRows Do
If Not ValueIsFilled(_Amount) Then
Break;
EndIf;

Row.Payment = Min(_Amount, Row.Amount);
_Amount = _Amount - Row.Payment;
ResultRow = GetEmptyRowTable();

FillPropertyValues(ResultRow, Row);

ResultRow.Insert("TotalAmount", Row.Payment);
ResultRow.Insert("BasisDocument", Row.Document);
ResultRow.Insert("Payee", Row.LegalName);
ResultRow.Insert("Payer", Row.LegalName);


Result.Add(ResultRow);

DocumentsRows = ThisObject.Documents.FindRows(New Structure("RowKey", Row.RowKey));
For Each DocumentRow In DocumentsRows Do
DocumentRow.Payment = Row.Payment;
EndDo;

EndDo;

Return Result;
EndFunction

&AtClientAtServerNoContext
Function GetEmptyRowTable()
EmptyRow = New Structure();
EmptyRow.Insert("Agreement");
EmptyRow.Insert("Amount");
EmptyRow.Insert("DocDate");
EmptyRow.Insert("Document");
EmptyRow.Insert("LegalName");
EmptyRow.Insert("LegalNameContract");
EmptyRow.Insert("Order");
EmptyRow.Insert("Partner");
EmptyRow.Insert("Payment");
EmptyRow.Insert("Project");
EmptyRow.Insert("RowKey");
Return EmptyRow;
EndFunction

&AtServer
Function SortRowsByDate(ArrayOfRows)
EmptyTable = ThisObject.Documents.Unload().CopyColumns();
For Each Row In ArrayOfRows Do
FillPropertyValues(EmptyTable.Add(), Row);
EndDo;

EmptyTable.Sort("DocDate");

NewArrayOfRows = New Array();

For Each Row In EmptyTable Do
NewRow = GetEmptyRowTable();
FillPropertyValues(NewRow, Row);
NewArrayOfRows.Add(NewRow);
EndDo;

Return NewArrayOfRows;
EndFunction

&AtClient
Procedure Cancel(Command)
Close();
EndProcedure

&AtClient
Procedure DocumentsBeforeAddRow(Item, Cancel, Clone, Parent, IsFolder, Parameter)
Cancel = True;
EndProcedure

&AtClient
Procedure DocumentsBeforeDeleteRow(Item, Cancel)
Cancel = True;
EndProcedure



18 changes: 18 additions & 0 deletions IRP/src/CommonForms/PaymentByDocuments/PaymentByDocuments.mdo
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<mdclass:CommonForm xmlns:mdclass="http://g5.1c.ru/v8/dt/metadata/mdclass" uuid="daeb6ec7-41e4-4980-bd89-da490a86b054">
<name>PaymentByDocuments</name>
<synonym>
<key>en</key>
<value>Payment by documents</value>
</synonym>
<synonym>
<key>ru</key>
<value>Оплата по документам</value>
</synonym>
<synonym>
<key>tr</key>
<value>Payment by documents</value>
</synonym>
<usePurposes>PersonalComputer</usePurposes>
<usePurposes>MobileDevice</usePurposes>
</mdclass:CommonForm>
13 changes: 13 additions & 0 deletions IRP/src/CommonModules/ViewClient_V2/Module.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -2610,6 +2610,19 @@ Procedure PaymentListBeforeAddRow(Object, Form, Cancel, Clone, CurrentData = Und
EndIf;
EndProcedure

Function PaymentListAddFilledRow(Object, Form, FillingValues) Export
Cancel = False;
Clone = False;
CurrentData = Undefined;
NewRow = AddOrCopyRow(Object, Form, "PaymentList", Cancel, Clone, CurrentData,
"PaymentListOnAddRowFormNotify", "PaymentListOnCopyRowFormNotify", FillingValues);
Form.Items.PaymentList.CurrentRow = NewRow.GetID();
If Form.Items.PaymentList.CurrentRow <> Undefined Then
Form.Items.PaymentList.ChangeRow();
EndIf;
Return NewRow;
EndFunction

Procedure PaymentListOnAddRowFormNotify(Parameters) Export
Parameters.Form.Modified = True;
EndProcedure
Expand Down
46 changes: 46 additions & 0 deletions IRP/src/CommonModules/ViewServer_V2/Module.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,18 @@ Procedure AddNewRowAtServer(TableName, Parameters, OnAddViewNotify, FillingValue
PositionIsPresent = CommonFunctionsClientServer.ObjectHasProperty(Row, "Position");
isControlCodeStringIsPresent = CommonFunctionsClientServer.ObjectHasProperty(Row, "isControlCodeString");

// Payment list
BasisDocumentIsPresent = CommonFunctionsClientServer.ObjectHasProperty(Row, "BasisDocument");
AgreementIsPresent = CommonFunctionsClientServer.ObjectHasProperty(Row, "Agreement");
TotalAmountIsPresent = CommonFunctionsClientServer.ObjectHasProperty(Row, "TotalAmount");
OrderIsPresent = CommonFunctionsClientServer.ObjectHasProperty(Row, "Order");
ProjectIsPresent = CommonFunctionsClientServer.ObjectHasProperty(Row, "Project");
LegalNameContractIsPresent = CommonFunctionsClientServer.ObjectHasProperty(Row, "LegalNameContract");
PayeeIsPresent = CommonFunctionsClientServer.ObjectHasProperty(Row, "Payee");
PayerIsPresent = CommonFunctionsClientServer.ObjectHasProperty(Row, "Payer");



If FillingValues.Property("Item") And ItemIsPresent Then
ControllerClientServer_V2.SetItemListItem(Parameters, PrepareValue(FillingValues.Item, Row.Key));
EndIf;
Expand Down Expand Up @@ -285,6 +297,40 @@ Procedure AddNewRowAtServer(TableName, Parameters, OnAddViewNotify, FillingValue
ControllerClientServer_V2.SetChequeBondsCheque(Parameters, PrepareValue(FillingValues.Cheque, Row.Key));
EndIf;

If TableName = "PaymentList" Then
If FillingValues.Property("BasisDocument") And BasisDocumentIsPresent Then
ControllerClientServer_V2.SetPaymentListBasisDocument(Parameters, PrepareValue(FillingValues.BasisDocument, Row.Key));
EndIf;

If FillingValues.Property("Agreement") And AgreementIsPresent Then
ControllerClientServer_V2.SetPaymentListAgreement(Parameters, PrepareValue(FillingValues.Agreement, Row.Key));
EndIf;

If FillingValues.Property("TotalAmount") And TotalAmountIsPresent Then
ControllerClientServer_V2.SetPaymentListTotalAmount(Parameters, PrepareValue(FillingValues.TotalAmount, Row.Key));
EndIf;

If FillingValues.Property("Order") And OrderIsPresent Then
ControllerClientServer_V2.SetPaymentListOrder(Parameters, PrepareValue(FillingValues.Order, Row.Key));
EndIf;

If FillingValues.Property("Project") And ProjectIsPresent Then
ControllerClientServer_V2.SetPaymentListProject(Parameters, PrepareValue(FillingValues.Project, Row.Key));
EndIf;

If FillingValues.Property("LegalNameContract") And LegalNameContractIsPresent Then
ControllerClientServer_V2.SetPaymentListLegalNameContract(Parameters, PrepareValue(FillingValues.LegalNameContract, Row.Key));
EndIf;

If FillingValues.Property("Payee") And PayeeIsPresent Then
ControllerClientServer_V2.SetPaymentListLegalName(Parameters, PrepareValue(FillingValues.Payee, Row.Key));
EndIf;

If FillingValues.Property("Payer") And PayerIsPresent Then
ControllerClientServer_V2.SetPaymentListLegalName(Parameters, PrepareValue(FillingValues.Payer, Row.Key));
EndIf;
EndIf;

If TableName = "TimeSheetList" Then
If FillingValues.Property("Employee") And EmployeeIsPresent Then
ControllerClientServer_V2.SetTimeSheetListEmployee(Parameters, PrepareValue(FillingValues.Employee, Row.Key));
Expand Down
1 change: 1 addition & 0 deletions IRP/src/Configuration/Configuration.mdo
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,7 @@
<commonForms>CommonForm.UpdateItemListInfo</commonForms>
<commonForms>CommonForm.BackgroundMultiJob</commonForms>
<commonForms>CommonForm.FormulaEditor</commonForms>
<commonForms>CommonForm.PaymentByDocuments</commonForms>
<catalogs>Catalog.AccessGroups</catalogs>
<catalogs>Catalog.AccessKey</catalogs>
<catalogs>Catalog.AccessProfiles</catalogs>
Expand Down
12 changes: 10 additions & 2 deletions IRP/src/DataProcessors/GroupPhotoUploading/Forms/Form/Module.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ Procedure LoadingOnClient()

If FilesPacket.Count() > 0 Then
//@skip-check invocation-parameter-type-intersect
Loading_SendServer(FilesPacket, ThisObject.PictureConnectionSetting);
Loading_SendServer(FilesPacket, ThisObject.PictureConnectionSetting, ThisObject.PreviewScaleSize);
For Each FileInfo In FilesPacket Do
FilesTableRecord = FilesTableMap.Get(FileInfo.FileID);
If FileInfo.Success = True Then
Expand Down Expand Up @@ -501,8 +501,9 @@ EndProcedure
// Parameters:
// FilesPacket - Array of Structure - Files packet
// ConnectionSettings - See IntegrationServer.ConnectionSetting
// PreviewScaleSize - Number - Preview scale size
&AtServerNoContext
Procedure Loading_SendServer(FilesPacket, ConnectionSettings)
Procedure Loading_SendServer(FilesPacket, ConnectionSettings, PreviewScaleSize)

Volume = PictureViewerServer.GetIntegrationSettingsPicture().DefaultPictureStorageVolume; // CatalogRef.FileStorageVolumes

Expand Down Expand Up @@ -542,6 +543,8 @@ Procedure Loading_SendServer(FilesPacket, ConnectionSettings)

FileInfo.Success = Not IsBlankString(FileInfo.URI);
If FileInfo.Success = True Then
FilePreview = PictureViewerServer.UpdatePictureInfoAndGetPreview(FileBody, PreviewScaleSize);
FillPropertyValues(FileInfo, FilePreview, "Preview,Size,Height,Width");
FileInfo.Insert("FileRef", PictureViewerServer.CreateFile(Volume, FileInfo));
EndIf;

Expand Down Expand Up @@ -650,6 +653,11 @@ EndProcedure
Procedure ShowCurrentSplashData() Export
SplashForm.Percent = PacketIndex;
SplashForm.EndDate = CommonFunctionsServer.GetCurrentSessionDate();

If PacketIndex > 0 Then
TotalTime = SplashForm.EndDate - SplashForm.StartTime;
SplashForm.EndIn = SplashForm.StartTime + TotalTime * (SplashForm.Items.Percent.MaxValue / PacketIndex);
EndIf;
EndProcedure

// Close splash form.
Expand Down
Loading

0 comments on commit 445da2e

Please sign in to comment.