A
A
Andrey Baranov2017-05-19 10:04:08
1C
Andrey Baranov, 2017-05-19 10:04:08

Summing values ​​of different item codes?

In general, there is a report in which certain values ​​are displayed. The report has a tabular form of the type:
Code | Name | Quantity
. It is necessary that in this report he displays the sum of the number of item codes and writes it into the item code (maybe not entirely clear).
Code that works now:
Procedure PrintRequestToShop(Button)
If ThisObject.Modification() Then
ThisObject.Write(DocumentWriteMode.Perform);
EndIf;
Request = New Request;
Query.Text=
"SELECT
| SummaryOrderInShopProducts.Code,
| SummaryOrderInShopProducts.Nomenclature AS Nomenclature,
| SummaryOrderInShopProducts.Weight,
| ConsolidatedOrderInShopProducts.BalanceCorrect,
| SummaryApplicationShopProducts.RequiredWeight,
| SummaryRequestInShopProducts.Nomenclature.Description AS NomenclatureDescription,
| SummaryRequestInShopProducts.Nomenclature.Parent AS NomenclatureParent
|FROM
| Document.SummaryRequestInShop.Goods AS SummaryRequestInShopProducts
|WHERE
| SummaryRequestInShopProducts.Link = &Document
|
|ORDER BY
| SummaryRequestInShopProducts.Nomenclature.Parent,
| SummaryApplicationShopProducts.Nomenclature.Description
| RESULTS ON
| Nomenclature
Parent |AUTOORDER";
Query.SetParameter("Document",ThisObject.Link);
TabDoc = New SpreadsheetDocument;
Layout = GetLayout("Report");
AreaHeader = Layout.GetArea("Header");
AreaFooter = Layout.GetArea("Basement");
TableHeader Area = Layout.GetArea("TableHeader");
AreaFooterTables = Layout.GetArea("FooterTables");
AreaDetailRecords = Layout.GetArea("Details");
AreaHeader.Parameters._Number = ""+ThisObject.Number;
AreaHeader.Parameters.ShippingDate = Format(ShippingDate,"DF=dd.MM.yyyy");;
TabDoc.Output(RegionHeader);
TabDoc.Output(TableHeaderArea);
Result = Request.Run();
SelectionDetails = Result.Select();
While SamplingDetails.
AreaDetailedRecords.Parameters.Fill(SelectionDetails);
TabDoc.Output(AreaDetailRecords, SelectionDetails.Level());
EndCycle;
TabDoc.Output(RegionFooterTable);
AreaFooter.Parameters.Operator = Infobase Users.CurrentUser();
TabDoc.Output(RegionFooter);
TabDoc.DisplayGroups = FALSE;
TabDoc.DisplayHeaders = FALSE;
TabDoc.DisplayGrid = FALSE;
TabDoc.ViewOnly = TRUE;
TabDoc.Show();
EndProcedure

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin, 2017-05-19
@fosihas

SELECT
Banks.City,
NUMBER(DIFFERENT Banks.City) AS City1
FROM
Directory.Banks AS Banks
GROUP BY
Banks.City

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question