Compare commits
No commits in common. "main" and "QA_old_version_57" have entirely different histories.
main
...
QA_old_ver
|
|
@ -1,54 +0,0 @@
|
||||||
-- Refinery (المصفاة): role REFINERY_OP (موظف عطاء الصرف) sees the الارساليات screen with the شحن الديزل (Excel) report, print and the
|
|
||||||
-- payment actions. Safe to re-run; not run by the app.
|
|
||||||
-- Run order: part 1 in the NTP schema (only needed where the role row is missing; it exists in the legacy data), part 2 in the primary
|
|
||||||
-- (NAFITHTCS) schema, after db/grains-screen-permissions.sql. Afterwards assign role REFINERY_OP to the users who need it (NTPUSERS):
|
|
||||||
-- they sign in as before. The API applies the rows within about a minute, the browser on the next reload / sign-in.
|
|
||||||
-- SU needs no rows. Everything else of the refinery module (wage claims, commission claims, wallets, variables, cards, the other
|
|
||||||
-- trip reports, the reverse-advance actions, recalculate balance) stays with REFINERY_MGR and SU.
|
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------------------------------------------------------------
|
|
||||||
-- Part 1 (NTP schema): the role row, copied from REFINERY_MGR (level, type, manager columns) when REFINERY_OP does not exist yet.
|
|
||||||
-- ---------------------------------------------------------------------------------------------------------------------------
|
|
||||||
INSERT INTO ROLES (CODE, NAME, DIRECTMANAGER, EMPLOYEES, MANAGERS, LEVELNUMBER, ROLETYPE, TENDER)
|
|
||||||
SELECT 'REFINERY_OP', 'موظف عطاء الصرف', r.DIRECTMANAGER, r.EMPLOYEES, r.MANAGERS, r.LEVELNUMBER, r.ROLETYPE, r.TENDER
|
|
||||||
FROM ROLES r
|
|
||||||
WHERE r.CODE = 'REFINERY_MGR'
|
|
||||||
AND NOT EXISTS (SELECT 1 FROM ROLES x WHERE x.CODE = 'REFINERY_OP');
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------------------------------------------------------------
|
|
||||||
-- Part 2 (primary schema): 13 keys.
|
|
||||||
-- screen refinery.trips (list, view, history)
|
|
||||||
-- report refinery.trips.dieselReport (شحن الديزل Excel)
|
|
||||||
-- print refinery.trips.print (cash voucher)
|
|
||||||
-- diesel refinery.trips.firstAdvance, secondAdvance
|
|
||||||
-- cash refinery.trips.cashPayment, receipt
|
|
||||||
-- bank / orange refinery.trips.payment, orangePayment
|
|
||||||
-- e-wallet refinery.trips.exchange, exchangeAudit, activateWalletExchange, confirmExchange (Dinarak is OFF until configured)
|
|
||||||
-- ---------------------------------------------------------------------------------------------------------------------------
|
|
||||||
INSERT INTO GRAINS_SCREEN_PERMISSIONS (ROLECODE, RESOURCE_KEY)
|
|
||||||
SELECT 'REFINERY_OP', v.resource_key
|
|
||||||
FROM (SELECT 'refinery.trips' AS resource_key FROM dual UNION ALL
|
|
||||||
SELECT 'refinery.trips.dieselReport' FROM dual UNION ALL
|
|
||||||
SELECT 'refinery.trips.print' FROM dual UNION ALL
|
|
||||||
SELECT 'refinery.trips.firstAdvance' FROM dual UNION ALL
|
|
||||||
SELECT 'refinery.trips.secondAdvance' FROM dual UNION ALL
|
|
||||||
SELECT 'refinery.trips.cashPayment' FROM dual UNION ALL
|
|
||||||
SELECT 'refinery.trips.receipt' FROM dual UNION ALL
|
|
||||||
SELECT 'refinery.trips.payment' FROM dual UNION ALL
|
|
||||||
SELECT 'refinery.trips.orangePayment' FROM dual UNION ALL
|
|
||||||
SELECT 'refinery.trips.exchange' FROM dual UNION ALL
|
|
||||||
SELECT 'refinery.trips.exchangeAudit' FROM dual UNION ALL
|
|
||||||
SELECT 'refinery.trips.activateWalletExchange' FROM dual UNION ALL
|
|
||||||
SELECT 'refinery.trips.confirmExchange' FROM dual) v
|
|
||||||
WHERE NOT EXISTS (
|
|
||||||
SELECT 1 FROM GRAINS_SCREEN_PERMISSIONS p
|
|
||||||
WHERE p.rolecode = 'REFINERY_OP' AND p.resource_key = v.resource_key);
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- Check (expect 13 rows):
|
|
||||||
-- SELECT resource_key FROM GRAINS_SCREEN_PERMISSIONS WHERE rolecode = 'REFINERY_OP' ORDER BY resource_key;
|
|
||||||
-- Take a right away by deleting its row, e.g.:
|
|
||||||
-- DELETE FROM GRAINS_SCREEN_PERMISSIONS WHERE rolecode = 'REFINERY_OP' AND resource_key = 'refinery.trips.confirmExchange';
|
|
||||||
|
|
@ -59,7 +59,6 @@ Apply these scripts once per database (not run by the application), in this orde
|
||||||
7. `db/grains-jobs.sql` - tables of the scheduled jobs (`GRAINS_JOBS`, `GRAINS_JOB_RUNS`), primary schema. Without it the scheduler stays idle. Jobs are then started, stopped and timed on the SU screen "المهام المجدولة" (`/jobs`); nothing runs until a job is started there. `Jobs:SchedulerEnabled=false` (set in appsettings.Development.json) switches the scheduler loop off for a process
|
7. `db/grains-jobs.sql` - tables of the scheduled jobs (`GRAINS_JOBS`, `GRAINS_JOB_RUNS`), primary schema. Without it the scheduler stays idle. Jobs are then started, stopped and timed on the SU screen "المهام المجدولة" (`/jobs`); nothing runs until a job is started there. `Jobs:SchedulerEnabled=false` (set in appsettings.Development.json) switches the scheduler loop off for a process
|
||||||
6. `db/gnac-finance-screens.sql` - GNAC gets claims, fines, wages, invoices and the invoice check report (safe to re-run)
|
6. `db/gnac-finance-screens.sql` - GNAC gets claims, fines, wages, invoices and the invoice check report (safe to re-run)
|
||||||
8. `db/refinery-permissions.sql` - refinery (المصفاة) modules: REFINERY_MGR gets the 6 screens and every action key (47 rows); SU needs none (safe to re-run). The external services are OFF until configured: `Refinery__Dinarak__Enabled/BaseUrl/UserName/Password` (trip payment) and `Refinery__Jopetrol__Enabled/Url/UserName/Password` (wage claim ترحيل); `Refinery__Trips__MaxPaymentAmount` (default 500, unverified)
|
8. `db/refinery-permissions.sql` - refinery (المصفاة) modules: REFINERY_MGR gets the 6 screens and every action key (47 rows); SU needs none (safe to re-run). The external services are OFF until configured: `Refinery__Dinarak__Enabled/BaseUrl/UserName/Password` (trip payment) and `Refinery__Jopetrol__Enabled/Url/UserName/Password` (wage claim ترحيل); `Refinery__Trips__MaxPaymentAmount` (default 500, unverified)
|
||||||
9. `db/refinery-op-permissions.sql` - role REFINERY_OP (موظف عطاء الصرف): the الارساليات screen, the شحن الديزل (Excel) report, print and the payment actions (13 keys); part 1 (role row, NTP schema) is only needed where the row is missing, part 2 (primary schema) writes the rows (safe to re-run). Everything else of the refinery module stays with REFINERY_MGR and SU
|
|
||||||
|
|
||||||
**Switching a feature off for everybody:** a row with `ROLECODE = 'DISABLED'` takes that resource out of the system for all users, SU
|
**Switching a feature off for everybody:** a row with `ROLECODE = 'DISABLED'` takes that resource out of the system for all users, SU
|
||||||
included: the menu entry and buttons disappear and the API answers 403. It overrides every other row. Delete the row to bring the
|
included: the menu entry and buttons disappear and the API answers 403. It overrides every other row. Delete the row to bring the
|
||||||
|
|
|
||||||
|
|
@ -1,291 +0,0 @@
|
||||||
using System.Globalization;
|
|
||||||
using System.IO.Compression;
|
|
||||||
using System.Security;
|
|
||||||
using System.Text;
|
|
||||||
using NTP.Application.Grains.Orders;
|
|
||||||
|
|
||||||
namespace NTP.Application.Refinery.Trips;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// One report in the layout of the legacy AqabaTCS reports (backend/common/report.cfc): company name and title on the first row,
|
|
||||||
/// the applied filters as label / value pairs, a spacer row, the column captions, then the rows. The first column is the counter
|
|
||||||
/// (متسلسل). <see cref="WidthsPt"/> are the legacy column widths in points.
|
|
||||||
/// </summary>
|
|
||||||
public sealed record LegacyReport(
|
|
||||||
string CompanyName,
|
|
||||||
string Title,
|
|
||||||
IReadOnlyList<(string Label, string Value)> Filters,
|
|
||||||
IReadOnlyList<string> Headers,
|
|
||||||
IReadOnlyList<int> WidthsPt,
|
|
||||||
IReadOnlyList<IReadOnlyList<object?>> Rows);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The legacy الحوالات list (refineryBankReport, companyreport.cfr): a banner with the company and the list title, a block with the
|
|
||||||
/// account details and the total, then the trips table. <see cref="Info"/> are the label / value rows of the block; <see cref="WidthsChars"/>
|
|
||||||
/// are the column widths in characters.
|
|
||||||
/// </summary>
|
|
||||||
public sealed record TransfersReport(
|
|
||||||
string CompanyName,
|
|
||||||
string Title,
|
|
||||||
IReadOnlyList<(string Label, object? Value)> Info,
|
|
||||||
IReadOnlyList<string> Headers,
|
|
||||||
IReadOnlyList<double> WidthsChars,
|
|
||||||
IReadOnlyList<IReadOnlyList<object?>> Rows);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Writes legacy-style reports as .xlsx workbooks (right-to-left sheet, Arial Unicode MS 11, centred and wrapped cells, navy #003366 header
|
|
||||||
/// cells with white text, thin borders). Strings are written as inline strings, so cell text can never be evaluated as a formula.
|
|
||||||
/// </summary>
|
|
||||||
public static class LegacyReportWorkbook
|
|
||||||
{
|
|
||||||
private const string Font = "Arial Unicode MS";
|
|
||||||
|
|
||||||
// cellXfs indexes of the report.cfc style sheet below
|
|
||||||
private const int Company = 1, Title = 2, Header = 3, FilterValue = 4, Data = 5;
|
|
||||||
// cellXfs indexes of the transfers style sheet
|
|
||||||
private const int TBanner = 1, TLabel = 2, TValue = 3, THeader = 4, TData = 5;
|
|
||||||
|
|
||||||
/// <summary>Legacy widths are points (ss:Width); the sheet needs characters: ((pt * 4/3) - 5) / 7.</summary>
|
|
||||||
public static double Chars(int points) => Math.Round((points * 4.0 / 3.0 - 5) / 7, 2);
|
|
||||||
|
|
||||||
public static byte[] ToXlsx(LegacyReport r) => Package(r.Title, Styles(), Sheet(r));
|
|
||||||
|
|
||||||
public static byte[] ToTransfersXlsx(TransfersReport r) => Package(r.Title, TransfersStyles(), TransfersSheet(r));
|
|
||||||
|
|
||||||
private static byte[] Package(string title, string styles, string sheet)
|
|
||||||
{
|
|
||||||
using var ms = new MemoryStream();
|
|
||||||
using (var zip = new ZipArchive(ms, ZipArchiveMode.Create, leaveOpen: true))
|
|
||||||
{
|
|
||||||
Add(zip, "[Content_Types].xml",
|
|
||||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\"><Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\"/><Default Extension=\"xml\" ContentType=\"application/xml\"/><Override PartName=\"/xl/workbook.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml\"/><Override PartName=\"/xl/worksheets/sheet1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml\"/><Override PartName=\"/xl/styles.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml\"/></Types>");
|
|
||||||
Add(zip, "_rels/.rels",
|
|
||||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\" Target=\"xl/workbook.xml\"/></Relationships>");
|
|
||||||
Add(zip, "xl/workbook.xml",
|
|
||||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><workbook xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"><sheets><sheet name=\""
|
|
||||||
+ Esc(SheetName(title)) + "\" sheetId=\"1\" r:id=\"rId1\"/></sheets></workbook>");
|
|
||||||
Add(zip, "xl/_rels/workbook.xml.rels",
|
|
||||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet\" Target=\"worksheets/sheet1.xml\"/><Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\" Target=\"styles.xml\"/></Relationships>");
|
|
||||||
Add(zip, "xl/styles.xml", styles);
|
|
||||||
Add(zip, "xl/worksheets/sheet1.xml", sheet);
|
|
||||||
}
|
|
||||||
return ms.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------ report.cfc layout
|
|
||||||
/// <summary>Style sheet: fonts 0 normal, 1 navy 14, 2 white 11, 3 black 12; fills 2 navy, 3 grey; borders 1 all thin black, 2 data row.</summary>
|
|
||||||
internal static string Styles()
|
|
||||||
{
|
|
||||||
static string F(int size, string color) => $"<font><sz val=\"{size}\"/><color rgb=\"{color}\"/><name val=\"{Font}\"/></font>";
|
|
||||||
static string B(string l, string r, string t, string b) =>
|
|
||||||
$"<border><left style=\"thin\"><color rgb=\"{l}\"/></left><right style=\"thin\"><color rgb=\"{r}\"/></right><top style=\"{(t.Length > 0 ? "thin" : "none")}\">{(t.Length > 0 ? $"<color rgb=\"{t}\"/>" : "")}</top><bottom style=\"thin\"><color rgb=\"{b}\"/></bottom><diagonal/></border>";
|
|
||||||
static string X(int font, int fill, int border, string h, string v) =>
|
|
||||||
$"<xf numFmtId=\"0\" fontId=\"{font}\" fillId=\"{fill}\" borderId=\"{border}\" xfId=\"0\" applyFont=\"1\" applyFill=\"1\" applyBorder=\"1\" applyAlignment=\"1\"><alignment horizontal=\"{h}\" vertical=\"{v}\" wrapText=\"1\"/></xf>";
|
|
||||||
var sb = new StringBuilder();
|
|
||||||
sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">");
|
|
||||||
sb.Append("<fonts count=\"4\">").Append(F(11, "FF000000")).Append(F(14, "FF003366")).Append(F(11, "FFFFFFFF")).Append(F(12, "FF000000")).Append("</fonts>");
|
|
||||||
sb.Append("<fills count=\"4\"><fill><patternFill patternType=\"none\"/></fill><fill><patternFill patternType=\"gray125\"/></fill>")
|
|
||||||
.Append("<fill><patternFill patternType=\"solid\"><fgColor rgb=\"FF003366\"/><bgColor indexed=\"64\"/></patternFill></fill>")
|
|
||||||
.Append("<fill><patternFill patternType=\"solid\"><fgColor rgb=\"FFC0C0C0\"/><bgColor indexed=\"64\"/></patternFill></fill></fills>");
|
|
||||||
sb.Append("<borders count=\"3\"><border><left/><right/><top/><bottom/><diagonal/></border>")
|
|
||||||
.Append(B("FF000000", "FF000000", "FF000000", "FF000000")) // header: black box
|
|
||||||
.Append(B("FF666699", "FF666699", "", "FF000000")) // data: violet sides, black bottom
|
|
||||||
.Append("</borders>");
|
|
||||||
sb.Append("<cellStyleXfs count=\"1\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\"/></cellStyleXfs>");
|
|
||||||
sb.Append("<cellXfs count=\"6\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\" xfId=\"0\" applyFont=\"1\"/>")
|
|
||||||
.Append(X(1, 0, 0, "right", "top")) // 1 company name
|
|
||||||
.Append(X(1, 0, 0, "center", "center")) // 2 title
|
|
||||||
.Append(X(2, 2, 1, "center", "top")) // 3 header / filter label
|
|
||||||
.Append(X(3, 3, 0, "center", "top")) // 4 filter value
|
|
||||||
.Append(X(0, 0, 2, "center", "top")) // 5 data
|
|
||||||
.Append("</cellXfs></styleSheet>");
|
|
||||||
return sb.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string Sheet(LegacyReport r)
|
|
||||||
{
|
|
||||||
var cols = r.Headers.Count;
|
|
||||||
var sb = new StringBuilder();
|
|
||||||
sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">");
|
|
||||||
sb.Append("<sheetViews><sheetView rightToLeft=\"1\" workbookViewId=\"0\"/></sheetViews><sheetFormatPr defaultRowHeight=\"15\"/>");
|
|
||||||
sb.Append("<cols>");
|
|
||||||
for (var c = 0; c < cols; c++)
|
|
||||||
Col(sb, c, Chars(c < r.WidthsPt.Count ? r.WidthsPt[c] : 150));
|
|
||||||
sb.Append("</cols><sheetData>");
|
|
||||||
|
|
||||||
// row 1: company name over the first three columns, title over columns E:F (legacy cell layout)
|
|
||||||
sb.Append("<row r=\"1\" ht=\"30\" customHeight=\"1\">");
|
|
||||||
Text(sb, 0, 1, r.CompanyName, Company);
|
|
||||||
Blank(sb, 1, 1, Company); Blank(sb, 2, 1, Company);
|
|
||||||
Text(sb, 4, 1, r.Title, Title);
|
|
||||||
Blank(sb, 5, 1, Title);
|
|
||||||
sb.Append("</row>");
|
|
||||||
|
|
||||||
// row 2: filters as label / value pairs
|
|
||||||
sb.Append("<row r=\"2\" ht=\"20\" customHeight=\"1\">");
|
|
||||||
var fc = 0;
|
|
||||||
foreach (var (label, value) in r.Filters)
|
|
||||||
{
|
|
||||||
Text(sb, fc++, 2, label, Header);
|
|
||||||
Text(sb, fc++, 2, value, FilterValue);
|
|
||||||
}
|
|
||||||
sb.Append("</row>");
|
|
||||||
|
|
||||||
// row 3: spacer, row 4: column captions
|
|
||||||
sb.Append("<row r=\"3\" ht=\"9.94\" customHeight=\"1\"/>");
|
|
||||||
sb.Append("<row r=\"4\" ht=\"20.06\" customHeight=\"1\">");
|
|
||||||
for (var c = 0; c < cols; c++) Text(sb, c, 4, r.Headers[c], Header);
|
|
||||||
sb.Append("</row>");
|
|
||||||
|
|
||||||
var rowNo = 5;
|
|
||||||
foreach (var row in r.Rows)
|
|
||||||
{
|
|
||||||
sb.Append("<row r=\"").Append(rowNo).Append("\" ht=\"24.06\">");
|
|
||||||
for (var c = 0; c < cols && c < row.Count; c++) Value(sb, c, rowNo, row[c], Data);
|
|
||||||
sb.Append("</row>");
|
|
||||||
rowNo++;
|
|
||||||
}
|
|
||||||
sb.Append("</sheetData><mergeCells count=\"2\"><mergeCell ref=\"A1:C1\"/><mergeCell ref=\"E1:F1\"/></mergeCells></worksheet>");
|
|
||||||
return sb.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------ الحوالات layout (companyreport.cfr output)
|
|
||||||
/// <summary>
|
|
||||||
/// Style sheet read from a legacy output file: fonts 1 Arial bold 21 (banner), 2 bold white 11 (labels), 3 bold black 11 (values), 4 white 11
|
|
||||||
/// (column captions), 0 black 11 (data); navy #003366 fills; thin borders, violet (#666699) sides on the data rows.
|
|
||||||
/// </summary>
|
|
||||||
internal static string TransfersStyles()
|
|
||||||
{
|
|
||||||
static string Fn(string name, int size, string color, bool bold) =>
|
|
||||||
$"<font>{(bold ? "<b/>" : "")}<sz val=\"{size}\"/><color rgb=\"{color}\"/><name val=\"{name}\"/></font>";
|
|
||||||
static string X(int font, int fill, int border, string h) =>
|
|
||||||
$"<xf numFmtId=\"0\" fontId=\"{font}\" fillId=\"{fill}\" borderId=\"{border}\" xfId=\"0\" applyFont=\"1\" applyFill=\"1\" applyBorder=\"1\" applyAlignment=\"1\"><alignment horizontal=\"{h}\" vertical=\"center\" wrapText=\"1\"/></xf>";
|
|
||||||
var sb = new StringBuilder();
|
|
||||||
sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">");
|
|
||||||
sb.Append("<fonts count=\"5\">").Append(Fn(Font, 11, "FF000000", false)).Append(Fn("Arial", 21, "FF000000", true))
|
|
||||||
.Append(Fn(Font, 11, "FFFFFFFF", true)).Append(Fn(Font, 11, "FF000000", true)).Append(Fn(Font, 11, "FFFFFFFF", false)).Append("</fonts>");
|
|
||||||
sb.Append("<fills count=\"4\"><fill><patternFill patternType=\"none\"/></fill><fill><patternFill patternType=\"gray125\"/></fill>")
|
|
||||||
.Append("<fill><patternFill patternType=\"solid\"><fgColor rgb=\"FF003366\"/><bgColor indexed=\"64\"/></patternFill></fill>")
|
|
||||||
.Append("<fill><patternFill patternType=\"solid\"><fgColor rgb=\"FFFFFFFF\"/><bgColor indexed=\"64\"/></patternFill></fill></fills>");
|
|
||||||
sb.Append("<borders count=\"3\"><border><left/><right/><top/><bottom/><diagonal/></border>")
|
|
||||||
.Append("<border><left style=\"thin\"><color rgb=\"FF000000\"/></left><right style=\"thin\"><color rgb=\"FF000000\"/></right><top style=\"thin\"><color rgb=\"FF000000\"/></top><bottom style=\"thin\"><color rgb=\"FF000000\"/></bottom><diagonal/></border>")
|
|
||||||
.Append("<border><left style=\"thin\"><color rgb=\"FF666699\"/></left><right style=\"thin\"><color rgb=\"FF666699\"/></right><top/><bottom style=\"thin\"><color rgb=\"FF000000\"/></bottom><diagonal/></border>")
|
|
||||||
.Append("</borders>");
|
|
||||||
sb.Append("<cellStyleXfs count=\"1\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\"/></cellStyleXfs>");
|
|
||||||
sb.Append("<cellXfs count=\"6\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\" xfId=\"0\" applyFont=\"1\"/>")
|
|
||||||
.Append(X(1, 0, 0, "center")) // 1 banner (company, title)
|
|
||||||
.Append(X(2, 2, 1, "center")) // 2 label of the account block
|
|
||||||
.Append(X(3, 3, 1, "right")) // 3 value of the account block
|
|
||||||
.Append(X(4, 2, 1, "center")) // 4 column caption
|
|
||||||
.Append(X(0, 3, 2, "center")) // 5 data
|
|
||||||
.Append("</cellXfs></styleSheet>");
|
|
||||||
return sb.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string TransfersSheet(TransfersReport r)
|
|
||||||
{
|
|
||||||
var cols = r.Headers.Count;
|
|
||||||
var last = TabularExport.ColumnName(cols - 1);
|
|
||||||
var merges = new List<string>();
|
|
||||||
var sb = new StringBuilder();
|
|
||||||
sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">");
|
|
||||||
sb.Append("<sheetViews><sheetView rightToLeft=\"1\" workbookViewId=\"0\"/></sheetViews><sheetFormatPr defaultRowHeight=\"12.75\"/>");
|
|
||||||
sb.Append("<cols>");
|
|
||||||
for (var c = 0; c < cols; c++) Col(sb, c, c < r.WidthsChars.Count ? r.WidthsChars[c] : 14);
|
|
||||||
sb.Append("</cols><sheetData>");
|
|
||||||
|
|
||||||
// rows 1-3: company, title, blank banner row, each merged over the whole table width
|
|
||||||
void Banner(int row, string? text)
|
|
||||||
{
|
|
||||||
sb.Append("<row r=\"").Append(row).Append("\" ht=\"27.75\" customHeight=\"1\">");
|
|
||||||
if (text is null) Blank(sb, 0, row, TBanner); else Text(sb, 0, row, text, TBanner);
|
|
||||||
for (var c = 1; c < cols; c++) Blank(sb, c, row, TBanner);
|
|
||||||
sb.Append("</row>");
|
|
||||||
merges.Add($"A{row}:{last}{row}");
|
|
||||||
}
|
|
||||||
Banner(1, r.CompanyName);
|
|
||||||
Banner(2, r.Title);
|
|
||||||
Banner(3, null);
|
|
||||||
|
|
||||||
// account block: label over A:B, value over C:last
|
|
||||||
var rowNo = 4;
|
|
||||||
foreach (var (label, value) in r.Info)
|
|
||||||
{
|
|
||||||
sb.Append("<row r=\"").Append(rowNo).Append("\" ht=\"28.5\" customHeight=\"1\">");
|
|
||||||
Text(sb, 0, rowNo, label, TLabel);
|
|
||||||
Blank(sb, 1, rowNo, TLabel);
|
|
||||||
Value(sb, 2, rowNo, value, TValue);
|
|
||||||
for (var c = 3; c < cols; c++) Blank(sb, c, rowNo, TValue);
|
|
||||||
sb.Append("</row>");
|
|
||||||
merges.Add($"A{rowNo}:B{rowNo}");
|
|
||||||
merges.Add($"C{rowNo}:{last}{rowNo}");
|
|
||||||
rowNo++;
|
|
||||||
}
|
|
||||||
// blank row, then the column captions (height 45)
|
|
||||||
sb.Append("<row r=\"").Append(rowNo).Append("\" ht=\"28.5\" customHeight=\"1\"/>");
|
|
||||||
merges.Add($"A{rowNo}:{last}{rowNo}");
|
|
||||||
rowNo++;
|
|
||||||
sb.Append("<row r=\"").Append(rowNo).Append("\" ht=\"45\" customHeight=\"1\">");
|
|
||||||
for (var c = 0; c < cols; c++) Text(sb, c, rowNo, r.Headers[c], THeader);
|
|
||||||
sb.Append("</row>");
|
|
||||||
rowNo++;
|
|
||||||
foreach (var row in r.Rows)
|
|
||||||
{
|
|
||||||
sb.Append("<row r=\"").Append(rowNo).Append("\" ht=\"24\" customHeight=\"1\">");
|
|
||||||
for (var c = 0; c < cols && c < row.Count; c++) Value(sb, c, rowNo, row[c], TData);
|
|
||||||
sb.Append("</row>");
|
|
||||||
rowNo++;
|
|
||||||
}
|
|
||||||
sb.Append("</sheetData><mergeCells count=\"").Append(merges.Count).Append("\">");
|
|
||||||
foreach (var m in merges) sb.Append("<mergeCell ref=\"").Append(m).Append("\"/>");
|
|
||||||
sb.Append("</mergeCells></worksheet>");
|
|
||||||
return sb.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------ shared pieces
|
|
||||||
private static void Col(StringBuilder sb, int c, double width) =>
|
|
||||||
sb.Append("<col min=\"").Append(c + 1).Append("\" max=\"").Append(c + 1).Append("\" width=\"")
|
|
||||||
.Append(width.ToString(CultureInfo.InvariantCulture)).Append("\" customWidth=\"1\"/>");
|
|
||||||
|
|
||||||
private static string Ref(int col, int row) => TabularExport.ColumnName(col) + row.ToString(CultureInfo.InvariantCulture);
|
|
||||||
|
|
||||||
private static void Blank(StringBuilder sb, int col, int row, int style) =>
|
|
||||||
sb.Append("<c r=\"").Append(Ref(col, row)).Append("\" s=\"").Append(style).Append("\"/>");
|
|
||||||
|
|
||||||
private static void Text(StringBuilder sb, int col, int row, string text, int style) =>
|
|
||||||
sb.Append("<c r=\"").Append(Ref(col, row)).Append("\" s=\"").Append(style).Append("\" t=\"inlineStr\"><is><t xml:space=\"preserve\">")
|
|
||||||
.Append(Esc(text)).Append("</t></is></c>");
|
|
||||||
|
|
||||||
private static void Value(StringBuilder sb, int col, int row, object? v, int style)
|
|
||||||
{
|
|
||||||
if (v is null) { Blank(sb, col, row, style); return; }
|
|
||||||
if (v is sbyte or byte or short or ushort or int or uint or long or ulong or float or double or decimal)
|
|
||||||
sb.Append("<c r=\"").Append(Ref(col, row)).Append("\" s=\"").Append(style).Append("\"><v>")
|
|
||||||
.Append(Convert.ToString(v, CultureInfo.InvariantCulture)).Append("</v></c>");
|
|
||||||
else Text(sb, col, row, TabularExport.FormatCell(v), style);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Sheet names: at most 31 characters and none of : \ / ? * [ ].</summary>
|
|
||||||
public static string SheetName(string title)
|
|
||||||
{
|
|
||||||
var s = new string(title.Where(ch => ":\\/?*[]".IndexOf(ch) < 0).ToArray()).Trim();
|
|
||||||
if (s.Length == 0) s = "Report";
|
|
||||||
return s.Length > 31 ? s[..31] : s;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Add(ZipArchive zip, string name, string content)
|
|
||||||
{
|
|
||||||
var entry = zip.CreateEntry(name, CompressionLevel.Fastest);
|
|
||||||
using var s = entry.Open();
|
|
||||||
var bytes = new UTF8Encoding(false).GetBytes(content);
|
|
||||||
s.Write(bytes, 0, bytes.Length);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string Esc(string s)
|
|
||||||
{
|
|
||||||
var clean = new StringBuilder(s.Length);
|
|
||||||
foreach (var ch in s)
|
|
||||||
if (ch == '\t' || ch == '\n' || ch == '\r' || ch >= 0x20 && ch != 0xFFFE && ch != 0xFFFF) clean.Append(ch);
|
|
||||||
return SecurityElement.Escape(clean.ToString()) ?? string.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -27,50 +27,6 @@ public sealed class TripReportService(ITripRepository trips) : ITripReportServic
|
||||||
|
|
||||||
private static string Day(DateTime? d) => d?.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture) ?? string.Empty;
|
private static string Day(DateTime? d) => d?.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture) ?? string.Empty;
|
||||||
|
|
||||||
// ---- legacy report layout (aqabaTCSBCommon.report.create): the trips, exchange and diesel-balance reports use it
|
|
||||||
private const string CompanyName = "شركة نافذ للخدمات اللوجستية"; // caption PUBLIC.NAFITH_NAME
|
|
||||||
private const string TripsTitle = "شاشة الارساليات"; // caption MENU.REFINERYTRIPS
|
|
||||||
private const string CardsTitle = "أرصدة الديزل"; // caption PUBLIC.CARD_REPORT
|
|
||||||
|
|
||||||
// column widths in points, as set in the legacy factory: report() manager set (650-820), refineryCardsReport (559-576)
|
|
||||||
private static readonly int[] TripsWidths =
|
|
||||||
[100, 150, 150, 150, 200, 200, 200, 200, 150, 150, 150, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 220, 200, 200, 200, 200, 200, 200, 200, 150];
|
|
||||||
private static readonly int[] CardsWidths = [100, 150, 150, 150];
|
|
||||||
|
|
||||||
private static TripExportFile Legacy(
|
|
||||||
string name, string title, IReadOnlyList<(string Label, string Value)> filters, string[] headers, int[] widths,
|
|
||||||
IReadOnlyList<IReadOnlyList<object?>> data) =>
|
|
||||||
new(LegacyReportWorkbook.ToXlsx(new LegacyReport(CompanyName, title, filters, headers, widths, data)),
|
|
||||||
$"{name}-{Stamp}.xlsx", TabularExport.XlsxContentType);
|
|
||||||
|
|
||||||
/// <summary>The filters row of the legacy report: the text filters in a fixed order (status shown with its caption), then the dates, oldest first.</summary>
|
|
||||||
public static IReadOnlyList<(string Label, string Value)> Filters(TripQuery q)
|
|
||||||
{
|
|
||||||
var f = new List<(string Label, string Value)>();
|
|
||||||
void Add(string label, string? v) { if (!string.IsNullOrWhiteSpace(v)) f.Add((label, v.Trim())); }
|
|
||||||
Add("رقم الارسالية", q.Pn);
|
|
||||||
Add("رقم القاطرة", q.Tn);
|
|
||||||
Add("رقم المقطورة", q.Trn);
|
|
||||||
Add("الرقم الوطني", q.Nnpn);
|
|
||||||
Add("رقم الحمولة", q.LoadingNo);
|
|
||||||
Add("رقم النموذج", q.DischargeAuthNo);
|
|
||||||
if (!string.IsNullOrWhiteSpace(q.StatusCode))
|
|
||||||
f.Add(("الحالة", string.Join("،", q.StatusCode.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)
|
|
||||||
.Select(s => s.Trim('\'')).Select(s => TripStatus.Captions.GetValueOrDefault(s, s)))));
|
|
||||||
Add("رقم مطالبة اجور النقل", q.WageClaimNo);
|
|
||||||
Add("رقم الحساب", q.BankAccount);
|
|
||||||
var dates = new List<(DateTime Value, string Label)>();
|
|
||||||
void AddDate(string label, DateTime? d) { if (d is not null) dates.Add((d.Value, label)); }
|
|
||||||
AddDate("تاريخ الارسالية", q.DispatchDate);
|
|
||||||
AddDate("تاريخ النموذج", q.DischargeEntryDate);
|
|
||||||
AddDate("من تاريخ التحميل", q.LoadingDateFrom);
|
|
||||||
AddDate("الى تاريخ التحميل", q.LoadingDateTo);
|
|
||||||
AddDate("من تاريخ الدفع", q.PaymentedDateFrom);
|
|
||||||
AddDate("الى تاريخ الدفع", q.PaymentedDateTo);
|
|
||||||
foreach (var (value, label) in dates.OrderBy(d => d.Value)) f.Add((label, Day(value)));
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<TripExportFile> TripsAsync(TripQuery query, CancellationToken ct)
|
public async Task<TripExportFile> TripsAsync(TripQuery query, CancellationToken ct)
|
||||||
{
|
{
|
||||||
TripQueryService.ValidateRanges(query);
|
TripQueryService.ValidateRanges(query);
|
||||||
|
|
@ -111,7 +67,7 @@ public sealed class TripReportService(ITripRepository trips) : ITripReportServic
|
||||||
"تاريخ الاستلام", "اسم المستلم", "تاريخ التحميل", "آلية الصرف", "صاحب الحساب", "صاحب الحساب بالانجليزي", "البنك", "IBAN",
|
"تاريخ الاستلام", "اسم المستلم", "تاريخ التحميل", "آلية الصرف", "صاحب الحساب", "صاحب الحساب بالانجليزي", "البنك", "IBAN",
|
||||||
"رقم الحساب", "رقم المحفظة", "رقم هوية المالك"
|
"رقم الحساب", "رقم المحفظة", "رقم هوية المالك"
|
||||||
];
|
];
|
||||||
return Legacy("refinery-trips", TripsTitle, Filters(query), headers, TripsWidths, data);
|
return Xlsx("refinery-trips", new ExportTable(["شاشة الارساليات"], headers, data));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>factoryweb.report, REFINERY_OP column set (lines 825-870): form no., truck, net wage, paid / received dates and receiver.
|
/// <summary>factoryweb.report, REFINERY_OP column set (lines 825-870): form no., truck, net wage, paid / received dates and receiver.
|
||||||
|
|
@ -126,49 +82,22 @@ public sealed class TripReportService(ITripRepository trips) : ITripReportServic
|
||||||
return Xlsx("refinery-trips-operator", new ExportTable(["شاشة الارساليات"], headers, data));
|
return Xlsx("refinery-trips-operator", new ExportTable(["شاشة الارساليات"], headers, data));
|
||||||
}
|
}
|
||||||
|
|
||||||
// legacy الحوالات list (companyreport.cfr output): title and column widths in characters, as in the legacy sample files
|
/// <summary>factoryweb.report, EXCHANGE_OP column set (lines 870-940): the trip, weights, truck, trailer, driver id, net wage and status.</summary>
|
||||||
private const string TransfersTitle = "قائمة ارقام نماذج التفريغ المعدة لصرف أجور النقل";
|
|
||||||
private static readonly double[] TransfersWidths = [9.14, 10.86, 16.71, 12.29, 12.71, 24.86, 12.29, 13.57, 13.71, 11.43, 15.43, 15.43, 24.29];
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// الحوالات (legacy refineryBankReport, layout of companyreport.cfr): the discharge forms prepared for payment by bank transfer to ONE account.
|
|
||||||
/// The bank account is required (ERROR.NO_BANK_ACCOUNT); the other filters are the legacy ones: status, wage-claim flag and payment dates.
|
|
||||||
/// The sheet shows the account block (owner, English name, bank, account number, IBAN, total net wage) and then the trips table.
|
|
||||||
/// </summary>
|
|
||||||
public async Task<TripExportFile> ExchangeAsync(TripQuery query, CancellationToken ct)
|
public async Task<TripExportFile> ExchangeAsync(TripQuery query, CancellationToken ct)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(query.BankAccount)) throw TripErrors.NoBankAccount();
|
TripQueryService.ValidateRanges(query);
|
||||||
if (query.PaymentedDateFrom > query.PaymentedDateTo) throw TripErrors.FromAfterTo();
|
var rows = await trips.ReportAsync(query, ct);
|
||||||
var q = new TripQuery(
|
|
||||||
BankAccount: query.BankAccount, StatusCode: query.StatusCode, HasWageClaim: query.HasWageClaim,
|
|
||||||
PaymentedDateFrom: query.PaymentedDateFrom, PaymentedDateTo: query.PaymentedDateTo);
|
|
||||||
var rows = await trips.ReportAsync(q, ct);
|
|
||||||
|
|
||||||
var first = rows.FirstOrDefault();
|
|
||||||
var total = Math.Round(rows.Sum(r => r.NetWage ?? 0m), 3);
|
|
||||||
IReadOnlyList<(string Label, object? Value)> info =
|
|
||||||
[
|
|
||||||
("صاحب الحساب", first?.OwnerName),
|
|
||||||
("الاسم بالانجليزي", first?.OwnerNameEnglish),
|
|
||||||
("اسم البنك", first?.BankName),
|
|
||||||
("رقم الحساب", first?.BankAccount ?? query.BankAccount.Trim()),
|
|
||||||
("IBAN", first?.Iban),
|
|
||||||
("صافي قيمة اجور النقل", total)
|
|
||||||
];
|
|
||||||
var data = rows.Select((r, i) => (IReadOnlyList<object?>)
|
var data = rows.Select((r, i) => (IReadOnlyList<object?>)
|
||||||
[
|
[
|
||||||
i + 1, r.Pn, r.DispatchDate, r.LoadingNo, r.DischargeAuthNo, r.DischargeEntryDate, r.NetLoadingWeight, r.NetDischargeWeight,
|
i + 1, r.Pn, r.DispatchDate, r.LoadingNo, r.DischargeAuthNo, r.DischargeEntryDate, r.NetLoadingWeight, r.NetDischargeWeight,
|
||||||
r.Tn, r.Trn, r.NetWage, TripStatus.Captions.GetValueOrDefault(r.StatusCode ?? string.Empty, r.StatusCode ?? string.Empty),
|
r.Tn, r.Trn, r.Nnpn, r.NetWage, TripStatus.Captions.GetValueOrDefault(r.StatusCode ?? string.Empty, r.StatusCode ?? string.Empty)
|
||||||
r.ReceivedDate?.ToString("dd/MM/yyyy HH:mm", CultureInfo.InvariantCulture)
|
|
||||||
]).ToList();
|
]).ToList();
|
||||||
string[] headers =
|
string[] headers =
|
||||||
[
|
[
|
||||||
"متسلسل", "رقم الارسالية", "تاريخ الارسالية", "رقم الحمولة", "رقم النموذج", "تاريخ النموذج", "الوزن الصافي للتحميل (كغ)",
|
"متسلسل", "رقم الارسالية", "تاريخ الارسالية", "رقم الحمولة", "رقم النموذج", "تاريخ النموذج", "الوزن الصافي(كغ)",
|
||||||
"الوزن الصافي للتفريغ(كغ)", "رقم القاطرة", "رقم المقطورة", "صافي قيمة اجور النقل", "الحالة", "تاريخ الاستلام"
|
"الوزن الصافي للتفريغ(كغ)", "رقم القاطرة", "رقم المقطورة", "الرقم الوطني", "صافي قيمة الصرف الفعلي", "الحالة"
|
||||||
];
|
];
|
||||||
return new(
|
return Xlsx("refinery-trips-exchange", new ExportTable(["شاشة الارساليات"], headers, data));
|
||||||
LegacyReportWorkbook.ToTransfersXlsx(new TransfersReport(CompanyName, TransfersTitle, info, headers, TransfersWidths, data)),
|
|
||||||
$"refinery-transfers-{Stamp}.xlsx", TabularExport.XlsxContentType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<TripExportFile> DieselAsync(DieselReportQuery query, CancellationToken ct)
|
public async Task<TripExportFile> DieselAsync(DieselReportQuery query, CancellationToken ct)
|
||||||
|
|
@ -194,8 +123,7 @@ public sealed class TripReportService(ITripRepository trips) : ITripReportServic
|
||||||
var rows = await trips.CardsAsync(string.IsNullOrWhiteSpace(tn) ? null : tn.Trim(), ct);
|
var rows = await trips.CardsAsync(string.IsNullOrWhiteSpace(tn) ? null : tn.Trim(), ct);
|
||||||
var data = rows.Select((r, i) => (IReadOnlyList<object?>)[i + 1, r.Tn, r.CardNumber, r.CurrentBalance]).ToList();
|
var data = rows.Select((r, i) => (IReadOnlyList<object?>)[i + 1, r.Tn, r.CardNumber, r.CurrentBalance]).ToList();
|
||||||
string[] headers = ["متسلسل", "رقم القاطرة", "رقم بطاقة جوبترول", "القيمة التراكمية الحالية"];
|
string[] headers = ["متسلسل", "رقم القاطرة", "رقم بطاقة جوبترول", "القيمة التراكمية الحالية"];
|
||||||
var filters = string.IsNullOrWhiteSpace(tn) ? [] : new List<(string Label, string Value)> { ("رقم القاطرة", tn.Trim()) };
|
return Xlsx("refinery-cards", new ExportTable(["أرصدة الديزل"], headers, data));
|
||||||
return Legacy("refinery-cards", CardsTitle, filters, headers, CardsWidths, data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<TripExportFile> BankAsync(BankReportQuery query, CancellationToken ct)
|
public async Task<TripExportFile> BankAsync(BankReportQuery query, CancellationToken ct)
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ internal sealed class VariablesRepository(IDbSession session, ILogger<VariablesR
|
||||||
if (total == 0) return new PagedResult<VariablesSetRow>([], page.SafePage, page.SafePageSize, 0);
|
if (total == 0) return new PagedResult<VariablesSetRow>([], page.SafePage, page.SafePageSize, 0);
|
||||||
p.Add("MinRow", page.MinRow);
|
p.Add("MinRow", page.MinRow);
|
||||||
p.Add("MaxRow", page.MaxRow);
|
p.Add("MaxRow", page.MaxRow);
|
||||||
var items = await QueryAsync<SetRowDb>(OracleSql.Paginate(baseSql + " ORDER BY g.StartDate DESC, g.GroupId DESC"), p, ct);
|
var items = await QueryAsync<SetRowDb>(OracleSql.Paginate(baseSql + " ORDER BY g.GroupId DESC"), p, ct);
|
||||||
return new PagedResult<VariablesSetRow>(items.Select(i => i.ToRow()).ToList(), page.SafePage, page.SafePageSize, total);
|
return new PagedResult<VariablesSetRow>(items.Select(i => i.ToRow()).ToList(), page.SafePage, page.SafePageSize, total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,159 +0,0 @@
|
||||||
using System.IO.Compression;
|
|
||||||
using System.Text;
|
|
||||||
using NTP.Application.Refinery.Trips;
|
|
||||||
using Xunit;
|
|
||||||
|
|
||||||
namespace NTP.Tests.Refinery;
|
|
||||||
|
|
||||||
/// <summary>The refinery Excel reports follow the layout of the legacy report.cfc (font, alignment, header colours, widths, RTL).</summary>
|
|
||||||
public class LegacyReportWorkbookTests
|
|
||||||
{
|
|
||||||
private static string Part(byte[] xlsx, string name)
|
|
||||||
{
|
|
||||||
using var zip = new ZipArchive(new MemoryStream(xlsx), ZipArchiveMode.Read);
|
|
||||||
using var s = zip.GetEntry(name)!.Open();
|
|
||||||
using var r = new StreamReader(s, Encoding.UTF8);
|
|
||||||
return r.ReadToEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static byte[] Sample(IReadOnlyList<(string, string)>? filters = null) =>
|
|
||||||
LegacyReportWorkbook.ToXlsx(new LegacyReport(
|
|
||||||
"شركة نافذ للخدمات اللوجستية", "أرصدة الديزل", filters ?? [("رقم القاطرة", "123")],
|
|
||||||
["متسلسل", "رقم القاطرة", "رقم بطاقة جوبترول", "القيمة التراكمية الحالية"], [100, 150, 150, 150],
|
|
||||||
[[1, "123", "=1+1", 55.5m]]));
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Sheet_is_right_to_left_with_the_legacy_title_row_and_merges()
|
|
||||||
{
|
|
||||||
var sheet = Part(Sample(), "xl/worksheets/sheet1.xml");
|
|
||||||
Assert.Contains("rightToLeft=\"1\"", sheet);
|
|
||||||
Assert.Contains("<mergeCell ref=\"A1:C1\"/>", sheet);
|
|
||||||
Assert.Contains("<mergeCell ref=\"E1:F1\"/>", sheet);
|
|
||||||
Assert.Contains("شركة نافذ للخدمات اللوجستية", sheet);
|
|
||||||
Assert.Contains("أرصدة الديزل", sheet);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Filters_are_label_value_pairs_on_row_two_and_the_header_is_on_row_four()
|
|
||||||
{
|
|
||||||
var sheet = Part(Sample(), "xl/worksheets/sheet1.xml");
|
|
||||||
Assert.Contains("<c r=\"A2\" s=\"3\" t=\"inlineStr\"><is><t xml:space=\"preserve\">رقم القاطرة</t>", sheet); // label in the header style
|
|
||||||
Assert.Contains("<c r=\"B2\" s=\"4\" t=\"inlineStr\"><is><t xml:space=\"preserve\">123</t>", sheet); // value in the grey style
|
|
||||||
Assert.Contains("<c r=\"A4\" s=\"3\" t=\"inlineStr\"><is><t xml:space=\"preserve\">متسلسل</t>", sheet);
|
|
||||||
Assert.Contains("<c r=\"A5\" s=\"5\"><v>1</v></c>", sheet); // counter, data style
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Styles_use_the_legacy_font_centre_alignment_and_navy_header()
|
|
||||||
{
|
|
||||||
var styles = Part(Sample(), "xl/styles.xml");
|
|
||||||
Assert.Contains("<name val=\"Arial Unicode MS\"/>", styles);
|
|
||||||
Assert.DoesNotContain("Calibri", styles);
|
|
||||||
Assert.Contains("rgb=\"FF003366\"", styles); // navy header fill
|
|
||||||
Assert.Contains("rgb=\"FFC0C0C0\"", styles); // grey filter values
|
|
||||||
Assert.Contains("horizontal=\"center\"", styles);
|
|
||||||
Assert.Contains("horizontal=\"right\"", styles); // company name
|
|
||||||
Assert.Contains("wrapText=\"1\"", styles);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Column_widths_follow_the_legacy_point_widths()
|
|
||||||
{
|
|
||||||
Assert.InRange(LegacyReportWorkbook.Chars(100), 18, 19);
|
|
||||||
Assert.True(LegacyReportWorkbook.Chars(200) > LegacyReportWorkbook.Chars(150));
|
|
||||||
Assert.True(LegacyReportWorkbook.Chars(150) > LegacyReportWorkbook.Chars(100));
|
|
||||||
var sheet = Part(Sample(), "xl/worksheets/sheet1.xml");
|
|
||||||
Assert.Equal(4, System.Text.RegularExpressions.Regex.Matches(sheet, "<col ").Count);
|
|
||||||
Assert.Contains("customWidth=\"1\"", sheet);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Cell_text_starting_with_equals_is_a_string_never_a_formula()
|
|
||||||
{
|
|
||||||
var sheet = Part(Sample(), "xl/worksheets/sheet1.xml");
|
|
||||||
Assert.DoesNotContain("<f>", sheet);
|
|
||||||
Assert.Contains("<t xml:space=\"preserve\">=1+1</t>", sheet);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Sheet_name_has_no_forbidden_characters_and_fits_31_characters()
|
|
||||||
{
|
|
||||||
Assert.Equal("Report", LegacyReportWorkbook.SheetName("[:*?/\\]"));
|
|
||||||
Assert.Equal(31, LegacyReportWorkbook.SheetName(new string('ا', 50)).Length);
|
|
||||||
Assert.Equal("أرصدة الديزل", LegacyReportWorkbook.SheetName("أرصدة الديزل"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static readonly string[] TransferHeaders =
|
|
||||||
[
|
|
||||||
"متسلسل", "رقم الارسالية", "تاريخ الارسالية", "رقم الحمولة", "رقم النموذج", "تاريخ النموذج", "الوزن الصافي للتحميل (كغ)",
|
|
||||||
"الوزن الصافي للتفريغ(كغ)", "رقم القاطرة", "رقم المقطورة", "صافي قيمة اجور النقل", "الحالة", "تاريخ الاستلام"
|
|
||||||
];
|
|
||||||
|
|
||||||
private static byte[] Transfers(IReadOnlyList<IReadOnlyList<object?>>? rows = null) =>
|
|
||||||
LegacyReportWorkbook.ToTransfersXlsx(new TransfersReport(
|
|
||||||
"شركة نافذ للخدمات اللوجستية", "قائمة ارقام نماذج التفريغ المعدة لصرف أجور النقل",
|
|
||||||
[("صاحب الحساب", "مكتب"), ("الاسم بالانجليزي", "OFFICE"), ("اسم البنك", "بنك"), ("رقم الحساب", "0055"), ("IBAN", "JO83"), ("صافي قيمة اجور النقل", 360.743m)],
|
|
||||||
TransferHeaders, [9.14, 10.86, 16.71, 12.29, 12.71, 24.86, 12.29, 13.57, 13.71, 11.43, 15.43, 15.43, 24.29],
|
|
||||||
rows ?? [[1, "318912", "03/07/2021", 23300L, "26680", "04/07/2021", 35600m, 35600m, "6059378", "7117953", 360.743m, "جاهز للدفع", "08/07/2021 13:37"]]));
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Transfers_sheet_has_the_legacy_cell_layout()
|
|
||||||
{
|
|
||||||
var sheet = Part(Transfers(), "xl/worksheets/sheet1.xml");
|
|
||||||
Assert.Contains("rightToLeft=\"1\"", sheet);
|
|
||||||
foreach (var m in new[] { "A1:M1", "A2:M2", "A3:M3", "A4:B4", "C4:M4", "A9:B9", "C9:M9", "A10:M10" })
|
|
||||||
Assert.Contains($"<mergeCell ref=\"{m}\"/>", sheet);
|
|
||||||
Assert.Contains("<c r=\"A4\" s=\"2\" t=\"inlineStr\"><is><t xml:space=\"preserve\">صاحب الحساب</t>", sheet); // label on A:B
|
|
||||||
Assert.Contains("<c r=\"C4\" s=\"3\" t=\"inlineStr\"><is><t xml:space=\"preserve\">مكتب</t>", sheet); // value on C:M
|
|
||||||
Assert.Contains("<c r=\"C9\" s=\"3\"><v>360.743</v></c>", sheet); // total, numeric
|
|
||||||
Assert.Contains("<row r=\"11\" ht=\"45\" customHeight=\"1\">", sheet); // captions on row 11
|
|
||||||
Assert.Contains("<c r=\"A11\" s=\"4\" t=\"inlineStr\"><is><t xml:space=\"preserve\">متسلسل</t>", sheet);
|
|
||||||
Assert.Contains("<c r=\"M11\" s=\"4\" t=\"inlineStr\"><is><t xml:space=\"preserve\">تاريخ الاستلام</t>", sheet);
|
|
||||||
Assert.Contains("<c r=\"A12\" s=\"5\"><v>1</v></c>", sheet); // first data row on row 12
|
|
||||||
Assert.Equal(13, System.Text.RegularExpressions.Regex.Matches(sheet, "<col ").Count);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Transfers_styles_follow_the_legacy_file()
|
|
||||||
{
|
|
||||||
var styles = Part(Transfers(), "xl/styles.xml");
|
|
||||||
Assert.Contains("<name val=\"Arial Unicode MS\"/>", styles);
|
|
||||||
Assert.Contains("<b/><sz val=\"21\"/>", styles); // banner: Arial bold 21
|
|
||||||
Assert.Contains("rgb=\"FF003366\"", styles); // navy labels and captions
|
|
||||||
Assert.Contains("horizontal=\"right\"", styles); // account values
|
|
||||||
Assert.Contains("horizontal=\"center\"", styles);
|
|
||||||
Assert.DoesNotContain("Calibri", styles);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Transfers_with_no_rows_still_has_the_block_and_the_captions()
|
|
||||||
{
|
|
||||||
var sheet = Part(Transfers([]), "xl/worksheets/sheet1.xml");
|
|
||||||
Assert.Contains("<c r=\"A11\" s=\"4\"", sheet);
|
|
||||||
Assert.DoesNotContain("<row r=\"12\"", sheet);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Transfers_report_needs_the_bank_account_number()
|
|
||||||
{
|
|
||||||
// validation happens before the repository is touched
|
|
||||||
var svc = new TripReportService(null!);
|
|
||||||
var e = await Assert.ThrowsAsync<NTP.Application.Common.BusinessException>(() => svc.ExchangeAsync(new TripQuery(), default));
|
|
||||||
Assert.Equal("يجب ادخال رقم الحساب", e.Message);
|
|
||||||
await Assert.ThrowsAsync<NTP.Application.Common.BusinessException>(() => svc.ExchangeAsync(new TripQuery(BankAccount: " "), default));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Trip_filters_show_status_captions_and_dates_oldest_first()
|
|
||||||
{
|
|
||||||
var f = TripReportService.Filters(new TripQuery(
|
|
||||||
Tn: " 55 ", StatusCode: "DISCHARGED,'RESD'", LoadingDateFrom: new DateTime(2026, 3, 1), LoadingDateTo: new DateTime(2026, 3, 31),
|
|
||||||
PaymentedDateFrom: new DateTime(2026, 1, 5)));
|
|
||||||
Assert.Equal(("رقم القاطرة", "55"), f[0]);
|
|
||||||
Assert.Equal("الحالة", f[1].Label);
|
|
||||||
Assert.Contains("تم التفريغ", f[1].Value);
|
|
||||||
Assert.Equal(new[] { "من تاريخ الدفع", "من تاريخ التحميل", "الى تاريخ التحميل" }, f.Skip(2).Select(x => x.Label).ToArray());
|
|
||||||
Assert.Equal("05/01/2026", f[2].Value);
|
|
||||||
Assert.Empty(TripReportService.Filters(new TripQuery()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
import { useEffect, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from 'react';
|
import { useEffect, useMemo, useState, type ReactNode } from 'react';
|
||||||
import { keepPreviousData, useQuery } from '@tanstack/react-query';
|
import { keepPreviousData, useQuery } from '@tanstack/react-query';
|
||||||
import { useLocation, useSearchParams } from 'react-router-dom';
|
import { useLocation, useSearchParams } from 'react-router-dom';
|
||||||
import {
|
import {
|
||||||
alpha, Alert, Badge, Box, Button, Chip, IconButton, ListItemIcon, ListItemText, Menu, MenuItem, Paper, Stack,
|
alpha, Alert, Badge, Box, Button, Chip, IconButton, ListItemIcon, ListItemText, Menu, MenuItem, Paper, Stack,
|
||||||
Table, TableBody, TableCell, TableContainer, TableHead, TablePagination, TableRow, Tooltip, Typography, useTheme,
|
Table, TableBody, TableCell, TableContainer, TableHead, TablePagination, TableRow, Tooltip, Typography, useTheme,
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
import CheckIcon from '@mui/icons-material/Check';
|
|
||||||
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
|
|
||||||
import FilterListIcon from '@mui/icons-material/FilterList';
|
import FilterListIcon from '@mui/icons-material/FilterList';
|
||||||
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
||||||
import EditOutlined from '@mui/icons-material/EditOutlined';
|
import EditOutlined from '@mui/icons-material/EditOutlined';
|
||||||
|
|
@ -257,7 +255,7 @@ export function DataGrid<T>({ meta }: DataGridProps<T>) {
|
||||||
{hasActions && actionsBefore && actionsCell(row)}
|
{hasActions && actionsBefore && actionsCell(row)}
|
||||||
{columns.map((c) => (
|
{columns.map((c) => (
|
||||||
<TableCell key={c.key} sx={cellSx(c)}>
|
<TableCell key={c.key} sx={cellSx(c)}>
|
||||||
{c.format === 'status' ? <Cell col={c} row={row} /> : <CopyCell><Cell col={c} row={row} /></CopyCell>}
|
<Cell col={c} row={row} />
|
||||||
</TableCell>
|
</TableCell>
|
||||||
))}
|
))}
|
||||||
{hasActions && !actionsBefore && actionsCell(row)}
|
{hasActions && !actionsBefore && actionsCell(row)}
|
||||||
|
|
@ -328,70 +326,6 @@ function cellSx(c: ColumnMeta<never>) {
|
||||||
...(c.hideBelow ? { display: { xs: 'none', [BP[c.hideBelow]]: 'table-cell' } } : {}),
|
...(c.hideBelow ? { display: { xs: 'none', [BP[c.hideBelow]]: 'table-cell' } } : {}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
/** Writes text to the clipboard (async API, with the old execCommand path for contexts where it is unavailable). */
|
|
||||||
async function copyText(text: string) {
|
|
||||||
try {
|
|
||||||
await navigator.clipboard.writeText(text);
|
|
||||||
} catch {
|
|
||||||
const ta = document.createElement('textarea');
|
|
||||||
ta.value = text;
|
|
||||||
ta.style.position = 'fixed';
|
|
||||||
ta.style.opacity = '0';
|
|
||||||
document.body.appendChild(ta);
|
|
||||||
ta.select();
|
|
||||||
try { document.execCommand('copy'); } finally { document.body.removeChild(ta); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A grid cell value with a small copy icon (shown on hover / keyboard focus, always on touch screens). It copies the text the cell
|
|
||||||
* shows; cells without text (icon-only columns) get no icon. No toast: the icon turns into a check mark for a moment.
|
|
||||||
*/
|
|
||||||
export function CopyCell({ children }: { children: ReactNode }) {
|
|
||||||
const { t } = useUi();
|
|
||||||
const ref = useRef<HTMLSpanElement>(null);
|
|
||||||
const [hasText, setHasText] = useState(false);
|
|
||||||
const [done, setDone] = useState(false);
|
|
||||||
useLayoutEffect(() => {
|
|
||||||
const has = (ref.current?.textContent ?? '').trim().length > 0;
|
|
||||||
setHasText((cur) => (cur === has ? cur : has));
|
|
||||||
});
|
|
||||||
useEffect(() => {
|
|
||||||
if (!done) return undefined;
|
|
||||||
const id = window.setTimeout(() => setDone(false), 1200);
|
|
||||||
return () => window.clearTimeout(id);
|
|
||||||
}, [done]);
|
|
||||||
return (
|
|
||||||
<Box
|
|
||||||
component="span"
|
|
||||||
sx={{
|
|
||||||
display: 'inline-flex', alignItems: 'center', gap: 0.5, maxWidth: '100%',
|
|
||||||
'& .copy-btn': { opacity: 0, transition: 'opacity .12s' },
|
|
||||||
'&:hover .copy-btn, & .copy-btn:focus-visible': { opacity: 1 },
|
|
||||||
'@media (hover: none)': { '& .copy-btn': { opacity: 0.6 } },
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span ref={ref}>{children}</span>
|
|
||||||
{hasText && (
|
|
||||||
<IconButton
|
|
||||||
className="copy-btn"
|
|
||||||
size="small"
|
|
||||||
title={t('common.copy')}
|
|
||||||
aria-label={t('common.copy')}
|
|
||||||
onClick={(e) => {
|
|
||||||
e.stopPropagation(); // the row click (open) must not fire
|
|
||||||
const text = (ref.current?.textContent ?? '').trim();
|
|
||||||
void copyText(text).then(() => setDone(true));
|
|
||||||
}}
|
|
||||||
sx={{ p: 0.25 }}
|
|
||||||
>
|
|
||||||
{done ? <CheckIcon sx={{ fontSize: 14 }} color="success" /> : <ContentCopyIcon sx={{ fontSize: 14 }} />}
|
|
||||||
</IconButton>
|
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function Cell<T>({ col, row }: { col: ColumnMeta<T>; row: T }): ReactNode {
|
function Cell<T>({ col, row }: { col: ColumnMeta<T>; row: T }): ReactNode {
|
||||||
const { lang } = useUi();
|
const { lang } = useUi();
|
||||||
if (col.render) return <>{col.render(row, { lang })}</>;
|
if (col.render) return <>{col.render(row, { lang })}</>;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
export { CopyCell, DataGrid, gridKey } from './DataGrid';
|
export { DataGrid, gridKey } from './DataGrid';
|
||||||
export type { DataGridProps } from './DataGrid';
|
export type { DataGridProps } from './DataGrid';
|
||||||
export { gridReturnUrl, rememberGridUrl } from './gridReturn';
|
export { gridReturnUrl, rememberGridUrl } from './gridReturn';
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,11 @@ const keys = () => [gridKey(GRID_CARDS), ['refinery.cards.one'], ['refinery.card
|
||||||
export const useCard = (id: number | null) =>
|
export const useCard = (id: number | null) =>
|
||||||
useQuery({ queryKey: ['refinery.cards.one', id], queryFn: () => api.get<CardRow>(`${BASE}/${id}`), enabled: id !== null });
|
useQuery({ queryKey: ['refinery.cards.one', id], queryFn: () => api.get<CardRow>(`${BASE}/${id}`), enabled: id !== null });
|
||||||
|
|
||||||
export const useCardLog = (id: number | null, page: number, pageSize: number, enabled = true) =>
|
export const useCardLog = (id: number | null, page: number, pageSize: number) =>
|
||||||
useQuery({
|
useQuery({
|
||||||
queryKey: ['refinery.cards.log', id, page, pageSize],
|
queryKey: ['refinery.cards.log', id, page, pageSize],
|
||||||
queryFn: () => api.get<PagedResult<CardLogRow>>(`${BASE}/${id}/log`, { page, pageSize }, { silent: true }),
|
queryFn: () => api.get<PagedResult<CardLogRow>>(`${BASE}/${id}/log`, { page, pageSize }, { silent: true }),
|
||||||
enabled: id !== null && enabled,
|
enabled: id !== null,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const useCreateCard = () =>
|
export const useCreateCard = () =>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
import { useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
import { useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
||||||
import {
|
import {
|
||||||
Alert, Box, Button, Collapse, Paper, Stack, Table, TableBody, TableCell, TableContainer, TableHead, TablePagination, TableRow, Typography,
|
Alert, Button, Paper, Stack, Table, TableBody, TableCell, TableContainer, TableHead, TablePagination, TableRow, Typography,
|
||||||
useTheme,
|
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
import AddIcon from '@mui/icons-material/Add';
|
import AddIcon from '@mui/icons-material/Add';
|
||||||
import BlockIcon from '@mui/icons-material/Block';
|
import BlockIcon from '@mui/icons-material/Block';
|
||||||
|
|
@ -72,74 +71,56 @@ export function CardsPage() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Movements of a card (legacy REFINERY_CARDS_logGrid, 5 per page). Collapsed until the title is clicked; nothing is fetched before. */
|
/** Movements of a card (legacy REFINERY_CARDS_logGrid, 5 per page). */
|
||||||
function CardLog({ id }: { id: number }) {
|
function CardLog({ id }: { id: number }) {
|
||||||
const { t, lang } = useFeatureUi(strings);
|
const { t, lang } = useFeatureUi(strings);
|
||||||
const dir = useTheme().direction;
|
|
||||||
const [open, setOpen] = useState(false);
|
|
||||||
const [page, setPage] = useState(0);
|
const [page, setPage] = useState(0);
|
||||||
const [pageSize, setPageSize] = useState(5);
|
const [pageSize, setPageSize] = useState(5);
|
||||||
const q = useCardLog(id, page + 1, pageSize, open);
|
const q = useCardLog(id, page + 1, pageSize);
|
||||||
const rows = q.data?.items ?? [];
|
const rows = q.data?.items ?? [];
|
||||||
const method = (m: string | null) => {
|
const method = (m: string | null) => {
|
||||||
const key = `rc.method.${m ?? ''}`;
|
const key = `rc.method.${m ?? ''}`;
|
||||||
return key in strings ? t(key as keyof typeof strings) : (m ?? '');
|
return key in strings ? t(key as keyof typeof strings) : (m ?? '');
|
||||||
};
|
};
|
||||||
// every column starts on the same edge as its header; digits and dates keep their left-to-right order inside the cell
|
|
||||||
const head = { fontWeight: 700, textAlign: 'start' } as const;
|
|
||||||
const cell = { textAlign: 'start' } as const;
|
|
||||||
const num = (v: number | null | undefined) => <bdi dir="ltr">{formatNumber(v, lang)}</bdi>;
|
|
||||||
const toggle = () => setOpen((o) => !o);
|
|
||||||
return (
|
return (
|
||||||
<SectionPaper sx={{ p: 2 }}>
|
<SectionPaper sx={{ p: 2 }}>
|
||||||
<Box
|
<SectionTitle icon={HistoryIcon} title={t('rc.log')} />
|
||||||
role="button" tabIndex={0} aria-expanded={open} onClick={toggle}
|
{q.isLoading ? <LoadingBanner /> : rows.length === 0 ? <Typography color="text.secondary">{t('rc.log.empty')}</Typography> : (
|
||||||
onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); toggle(); } }}
|
<>
|
||||||
sx={{ cursor: 'pointer', '& h2': { mb: open ? 1.5 : 0 } }}
|
<TableContainer component={Paper} variant="outlined">
|
||||||
>
|
<Table size="small">
|
||||||
<SectionTitle icon={HistoryIcon} title={t('rc.log')} />
|
<TableHead>
|
||||||
</Box>
|
<TableRow>
|
||||||
<Collapse in={open} unmountOnExit>
|
<TableCell>{t('rc.log.method')}</TableCell>
|
||||||
{q.isLoading ? <LoadingBanner /> : rows.length === 0 ? <Typography color="text.secondary">{t('rc.log.empty')}</Typography> : (
|
<TableCell>{t('rc.log.date')}</TableCell>
|
||||||
<>
|
<TableCell>{t('rc.log.user')}</TableCell>
|
||||||
<TableContainer component={Paper} variant="outlined">
|
<TableCell>{t('rc.log.before')}</TableCell>
|
||||||
<Table size="small">
|
<TableCell>{t('rc.log.after')}</TableCell>
|
||||||
<TableHead>
|
<TableCell>{t('rc.log.amount')}</TableCell>
|
||||||
<TableRow>
|
<TableCell>{t('rc.log.pn')}</TableCell>
|
||||||
<TableCell sx={head}>{t('rc.log.method')}</TableCell>
|
</TableRow>
|
||||||
<TableCell sx={head}>{t('rc.log.date')}</TableCell>
|
</TableHead>
|
||||||
<TableCell sx={head}>{t('rc.log.user')}</TableCell>
|
<TableBody>
|
||||||
<TableCell sx={head}>{t('rc.log.before')}</TableCell>
|
{rows.map((r) => (
|
||||||
<TableCell sx={head}>{t('rc.log.after')}</TableCell>
|
<TableRow key={r.id}>
|
||||||
<TableCell sx={head}>{t('rc.log.amount')}</TableCell>
|
<TableCell>{method(r.methodName)}</TableCell>
|
||||||
<TableCell sx={head}>{t('rc.log.pn')}</TableCell>
|
<TableCell dir="ltr">{formatDateTime(r.lastUpdateDate)}</TableCell>
|
||||||
|
<TableCell dir="ltr">{r.updatedBy}</TableCell>
|
||||||
|
<TableCell dir="ltr">{formatNumber(r.balanceBefore, lang)}</TableCell>
|
||||||
|
<TableCell dir="ltr">{formatNumber(r.balanceAfter, lang)}</TableCell>
|
||||||
|
<TableCell dir="ltr">{formatNumber(r.amount, lang)}</TableCell>
|
||||||
|
<TableCell dir="ltr">{r.pn && r.pn !== '0' ? r.pn : ''}</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHead>
|
))}
|
||||||
<TableBody>
|
</TableBody>
|
||||||
{rows.map((r) => (
|
</Table>
|
||||||
<TableRow key={r.id}>
|
</TableContainer>
|
||||||
<TableCell sx={cell}>{method(r.methodName)}</TableCell>
|
<TablePagination
|
||||||
<TableCell sx={cell}><bdi dir="ltr">{formatDateTime(r.lastUpdateDate)}</bdi></TableCell>
|
component="div" count={q.data?.totalCount ?? 0} page={page} rowsPerPage={pageSize} rowsPerPageOptions={[5, 10, 25]}
|
||||||
<TableCell sx={cell}><bdi dir="ltr">{r.updatedBy}</bdi></TableCell>
|
onPageChange={(_, p) => setPage(p)} onRowsPerPageChange={(e) => { setPageSize(Number(e.target.value)); setPage(0); }}
|
||||||
<TableCell sx={cell}>{num(r.balanceBefore)}</TableCell>
|
/>
|
||||||
<TableCell sx={cell}>{num(r.balanceAfter)}</TableCell>
|
</>
|
||||||
<TableCell sx={cell}>{num(r.amount)}</TableCell>
|
)}
|
||||||
<TableCell sx={cell}><bdi dir="ltr">{r.pn && r.pn !== '0' ? r.pn : ''}</bdi></TableCell>
|
|
||||||
</TableRow>
|
|
||||||
))}
|
|
||||||
</TableBody>
|
|
||||||
</Table>
|
|
||||||
</TableContainer>
|
|
||||||
<TablePagination
|
|
||||||
component="div" count={q.data?.totalCount ?? 0} page={page} rowsPerPage={pageSize} rowsPerPageOptions={[5, 10, 25]}
|
|
||||||
onPageChange={(_, p) => setPage(p)} onRowsPerPageChange={(e) => { setPageSize(Number(e.target.value)); setPage(0); }}
|
|
||||||
labelRowsPerPage={t('grid.rowsPerPage')}
|
|
||||||
labelDisplayedRows={({ from, to, count }) => t('grid.displayedRows', { from, to, count })}
|
|
||||||
sx={{ '.MuiTablePagination-spacer': { display: 'none' }, '.MuiTablePagination-toolbar': { flexWrap: 'wrap', justifyContent: dir === 'rtl' ? 'flex-end' : 'flex-start' } }}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</Collapse>
|
|
||||||
</SectionPaper>
|
</SectionPaper>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import PaymentsIcon from '@mui/icons-material/Payments';
|
||||||
import SearchIcon from '@mui/icons-material/Search';
|
import SearchIcon from '@mui/icons-material/Search';
|
||||||
import AssignmentIcon from '@mui/icons-material/Assignment';
|
import AssignmentIcon from '@mui/icons-material/Assignment';
|
||||||
import ReceiptLongIcon from '@mui/icons-material/ReceiptLong';
|
import ReceiptLongIcon from '@mui/icons-material/ReceiptLong';
|
||||||
import { CopyCell, DataGrid } from '@/components/DataGrid';
|
import { DataGrid } from '@/components/DataGrid';
|
||||||
import { LoadingBanner } from '@/components/LoadingBanner';
|
import { LoadingBanner } from '@/components/LoadingBanner';
|
||||||
import { PageHeader } from '@/components/PageHeader';
|
import { PageHeader } from '@/components/PageHeader';
|
||||||
import { StatusChip } from '@/components/StatusChip';
|
import { StatusChip } from '@/components/StatusChip';
|
||||||
|
|
@ -63,9 +63,9 @@ function WageClaimsTable(p: {
|
||||||
{selectable && (
|
{selectable && (
|
||||||
<TableCell padding="checkbox"><Checkbox checked={p.selected!.has(r.id)} onChange={() => p.onToggle?.(r.id)} /></TableCell>
|
<TableCell padding="checkbox"><Checkbox checked={p.selected!.has(r.id)} onChange={() => p.onToggle?.(r.id)} /></TableCell>
|
||||||
)}
|
)}
|
||||||
<TableCell sx={ltr}><CopyCell>{r.wageClaimNo}</CopyCell></TableCell>
|
<TableCell sx={ltr}>{r.wageClaimNo}</TableCell>
|
||||||
<TableCell sx={ltr}><CopyCell>{formatDate(r.wageClaimDate)}</CopyCell></TableCell>
|
<TableCell sx={ltr}>{formatDate(r.wageClaimDate)}</TableCell>
|
||||||
<TableCell sx={ltr}><CopyCell>{r.tripCnt}</CopyCell></TableCell>
|
<TableCell sx={ltr}>{r.tripCnt}</TableCell>
|
||||||
<TableCell><StatusChip value={r.statusCode} statuses={claimStatuses} /></TableCell>
|
<TableCell><StatusChip value={r.statusCode} statuses={claimStatuses} /></TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
))}
|
))}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { useState, type ElementType, type ReactNode } from 'react';
|
||||||
import { Link as RouterLink, useNavigate, useParams } from 'react-router-dom';
|
import { Link as RouterLink, useNavigate, useParams } from 'react-router-dom';
|
||||||
import {
|
import {
|
||||||
Alert, Box, Button, Dialog, GlobalStyles, DialogActions, DialogContent, DialogTitle, Link, Menu, MenuItem, Stack, Table, TableBody, TableCell,
|
Alert, Box, Button, Dialog, GlobalStyles, DialogActions, DialogContent, DialogTitle, Link, Menu, MenuItem, Stack, Table, TableBody, TableCell,
|
||||||
TableHead, TableRow, TablePagination, TextField, Typography,
|
TableHead, TableRow, TablePagination, Typography,
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
import SummarizeIcon from '@mui/icons-material/Summarize';
|
import SummarizeIcon from '@mui/icons-material/Summarize';
|
||||||
import PrintIcon from '@mui/icons-material/Print';
|
import PrintIcon from '@mui/icons-material/Print';
|
||||||
|
|
@ -53,37 +53,18 @@ export function TripsPage() {
|
||||||
};
|
};
|
||||||
// the report uses the filters of the list (they are in the URL query string)
|
// the report uses the filters of the list (they are in the URL query string)
|
||||||
const current = () => Object.fromEntries([...new URLSearchParams(window.location.search)].filter(([k]) => !['page', 'size', 'f'].includes(k)));
|
const current = () => Object.fromEntries([...new URLSearchParams(window.location.search)].filter(([k]) => !['page', 'size', 'f'].includes(k)));
|
||||||
|
|
||||||
// the account-list reports (الحوالات and the bank report) cannot run without a bank account number: a dialog asks for it and refuses an empty value
|
|
||||||
const [ask, setAsk] = useState<'exchange' | 'bank' | null>(null);
|
|
||||||
const [account, setAccount] = useState('');
|
|
||||||
const [accountError, setAccountError] = useState(false);
|
|
||||||
const askAccount = (kind: 'exchange' | 'bank') => {
|
|
||||||
setMenu(null);
|
|
||||||
setAccount(current().bankAccount ?? '');
|
|
||||||
setAccountError(false);
|
|
||||||
setAsk(kind);
|
|
||||||
};
|
|
||||||
const submitAccount = () => {
|
|
||||||
const value = account.trim();
|
|
||||||
if (!value) { setAccountError(true); return; }
|
|
||||||
// the legacy filters of the list: status, wage-claim flag and payment dates
|
|
||||||
const c = current();
|
|
||||||
const params: Record<string, string> = { bankAccount: value };
|
|
||||||
for (const k of ['statusCode', 'hasWageClaim', 'paymentedDateFrom', 'paymentedDateTo']) if (c[k]) params[k] = c[k];
|
|
||||||
const kind = ask;
|
|
||||||
setAsk(null);
|
|
||||||
if (kind === 'exchange') void run('exchange', params, 'refinery-transfers.xlsx');
|
|
||||||
else if (kind === 'bank') void run('bank', params, 'refinery-bank.xlsx');
|
|
||||||
};
|
|
||||||
const reports: { key: string; label: string; show: boolean; go: () => void }[] = [
|
const reports: { key: string; label: string; show: boolean; go: () => void }[] = [
|
||||||
{ key: 'trips', label: t('trips.report.trips'), show: can('refinery.trips.report'), go: () => void run('trips', current(), 'refinery-trips.xlsx') },
|
{ key: 'trips', label: t('trips.report.trips'), show: can('refinery.trips.report'), go: () => void run('trips', current(), 'refinery-trips.xlsx') },
|
||||||
{ key: 'operator', label: t('trips.report.operator'), show: can('refinery.trips.operatorReport'), go: () => void run('operator', current(), 'refinery-trips-operator.xlsx') },
|
{ key: 'operator', label: t('trips.report.operator'), show: can('refinery.trips.operatorReport'), go: () => void run('operator', current(), 'refinery-trips-operator.xlsx') },
|
||||||
// الحوالات: the list of ONE bank account (legacy refineryBankReport): the account number is mandatory, see the dialog below
|
{ key: 'exchange', label: t('trips.report.exchange'), show: can('refinery.trips.exchangeReport'), go: () => void run('exchange', current(), 'refinery-trips-exchange.xlsx') },
|
||||||
{ key: 'exchange', label: t('trips.report.exchange'), show: can('refinery.trips.exchangeReport'), go: () => askAccount('exchange') },
|
|
||||||
{ key: 'diesel', label: t('trips.report.diesel'), show: can('refinery.trips.dieselReport'), go: () => void run('diesel', current(), 'refinery-diesel.xlsx') },
|
{ key: 'diesel', label: t('trips.report.diesel'), show: can('refinery.trips.dieselReport'), go: () => void run('diesel', current(), 'refinery-diesel.xlsx') },
|
||||||
{ key: 'cards', label: t('trips.report.cards'), show: can('refinery.trips.cardsReport'), go: () => void run('cards', { tn: current().tn ?? '' }, 'refinery-cards.xlsx') },
|
{ key: 'cards', label: t('trips.report.cards'), show: can('refinery.trips.cardsReport'), go: () => void run('cards', { tn: current().tn ?? '' }, 'refinery-cards.xlsx') },
|
||||||
{ key: 'bank', label: t('trips.report.bank'), show: can('refinery.trips.bankReport'), go: () => askAccount('bank') },
|
{
|
||||||
|
key: 'bank', label: t('trips.report.bank'), show: can('refinery.trips.bankReport'), go: () => {
|
||||||
|
const account = window.prompt(t('trips.report.bankAsk'), current().bankAccount ?? '');
|
||||||
|
if (account) void run('bank', { bankAccount: account, statusCode: current().statusCode ?? '' }, 'refinery-bank.xlsx');
|
||||||
|
},
|
||||||
|
},
|
||||||
].filter((r) => r.show);
|
].filter((r) => r.show);
|
||||||
|
|
||||||
const meta = tripsGrid((r) => navigate(`${ROOT}/${r.id}`));
|
const meta = tripsGrid((r) => navigate(`${ROOT}/${r.id}`));
|
||||||
|
|
@ -101,23 +82,6 @@ export function TripsPage() {
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<DataGrid meta={meta} />
|
<DataGrid meta={meta} />
|
||||||
<Dialog open={ask !== null} onClose={() => setAsk(null)} fullWidth maxWidth="xs">
|
|
||||||
<form noValidate onSubmit={(e) => { e.preventDefault(); submitAccount(); }}>
|
|
||||||
<DialogTitle>{ask === 'bank' ? t('trips.report.bank') : t('trips.report.exchange')}</DialogTitle>
|
|
||||||
<DialogContent>
|
|
||||||
<TextField
|
|
||||||
autoFocus required fullWidth margin="dense" label={t('trips.bankAccount')} value={account}
|
|
||||||
onChange={(e) => { setAccount(e.target.value); if (e.target.value.trim()) setAccountError(false); }}
|
|
||||||
error={accountError} helperText={accountError ? t('trips.report.bankAsk') : ' '}
|
|
||||||
slotProps={{ htmlInput: { dir: 'ltr' } }}
|
|
||||||
/>
|
|
||||||
</DialogContent>
|
|
||||||
<DialogActions>
|
|
||||||
<Button onClick={() => setAsk(null)}>{t('common.cancel')}</Button>
|
|
||||||
<Button type="submit" variant="contained">{t('trips.report.create')}</Button>
|
|
||||||
</DialogActions>
|
|
||||||
</form>
|
|
||||||
</Dialog>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,12 +46,11 @@ export default defineStrings({
|
||||||
'trips.reports': { en: 'Reports', ar: 'التقارير' },
|
'trips.reports': { en: 'Reports', ar: 'التقارير' },
|
||||||
'trips.report.trips': { en: 'Trips (Excel)', ar: 'الارساليات (Excel)' },
|
'trips.report.trips': { en: 'Trips (Excel)', ar: 'الارساليات (Excel)' },
|
||||||
'trips.report.operator': { en: 'Trips - operator (Excel)', ar: 'الارساليات - المشغل (Excel)' },
|
'trips.report.operator': { en: 'Trips - operator (Excel)', ar: 'الارساليات - المشغل (Excel)' },
|
||||||
'trips.report.exchange': { en: 'Transfers (Excel)', ar: 'الحوالات (Excel)' },
|
'trips.report.exchange': { en: 'Trips - exchange (Excel)', ar: 'الارساليات - الصرف (Excel)' },
|
||||||
'trips.report.diesel': { en: 'Diesel charges (Excel)', ar: 'شحن الديزل (Excel)' },
|
'trips.report.diesel': { en: 'Diesel charges (Excel)', ar: 'شحن الديزل (Excel)' },
|
||||||
'trips.report.cards': { en: 'Diesel balances (Excel)', ar: 'أرصدة الديزل (Excel)' },
|
'trips.report.cards': { en: 'Diesel balances (Excel)', ar: 'أرصدة الديزل (Excel)' },
|
||||||
'trips.report.bank': { en: 'Bank report (Excel)', ar: 'تقرير البنك (Excel)' },
|
'trips.report.bank': { en: 'Bank report (Excel)', ar: 'تقرير البنك (Excel)' },
|
||||||
'trips.report.bankAsk': { en: 'The bank account number is required', ar: 'يجب ادخال رقم الحساب' },
|
'trips.report.bankAsk': { en: 'Enter the bank account number of the report', ar: 'يجب ادخال رقم الحساب' },
|
||||||
'trips.report.create': { en: 'Create report', ar: 'إنشاء التقرير' },
|
|
||||||
'trips.report.done': { en: 'The report was generated', ar: 'تم انشاء التقرير بنجاح' },
|
'trips.report.done': { en: 'The report was generated', ar: 'تم انشاء التقرير بنجاح' },
|
||||||
|
|
||||||
// form sections
|
// form sections
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,15 @@ import { GRID_VARIABLES, type VariablesRow } from './api';
|
||||||
|
|
||||||
const s = strings;
|
const s = strings;
|
||||||
|
|
||||||
/** Legacy REFINERY_VARIABLESGRID: period, then the prices; the filters are the two period dates. The API lists the newest period first. */
|
const p2 = (n: number) => String(n).padStart(2, '0');
|
||||||
|
const iso = (d: Date) => `${d.getFullYear()}-${p2(d.getMonth() + 1)}-${p2(d.getDate())}`;
|
||||||
|
/** First and last day of the current month as the grid's startDate / endDate filters. */
|
||||||
|
const monthRange = () => {
|
||||||
|
const now = new Date();
|
||||||
|
return { startDate: iso(new Date(now.getFullYear(), now.getMonth(), 1)), endDate: iso(new Date(now.getFullYear(), now.getMonth() + 1, 0)) };
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Legacy REFINERY_VARIABLESGRID: period, then the prices; the filters are the two period dates. */
|
||||||
export function variablesGrid(h: { onOpen: (r: VariablesRow) => void }): GridMeta<VariablesRow> {
|
export function variablesGrid(h: { onOpen: (r: VariablesRow) => void }): GridMeta<VariablesRow> {
|
||||||
return {
|
return {
|
||||||
key: GRID_VARIABLES,
|
key: GRID_VARIABLES,
|
||||||
|
|
@ -13,6 +21,8 @@ export function variablesGrid(h: { onOpen: (r: VariablesRow) => void }): GridMet
|
||||||
onRowClick: h.onOpen,
|
onRowClick: h.onOpen,
|
||||||
pageSize: 16,
|
pageSize: 16,
|
||||||
emptyAsGrid: true,
|
emptyAsGrid: true,
|
||||||
|
// opens on the periods that start in the current month (first day .. last day)
|
||||||
|
defaultFilters: monthRange(),
|
||||||
filters: [
|
filters: [
|
||||||
{ name: 'startDate', type: 'date', label: s['rv.filter.startDate'] },
|
{ name: 'startDate', type: 'date', label: s['rv.filter.startDate'] },
|
||||||
{ name: 'endDate', type: 'date', label: s['rv.filter.endDate'] },
|
{ name: 'endDate', type: 'date', label: s['rv.filter.endDate'] },
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import {
|
||||||
import HistoryIcon from '@mui/icons-material/History';
|
import HistoryIcon from '@mui/icons-material/History';
|
||||||
import VisibilityOutlined from '@mui/icons-material/VisibilityOutlined';
|
import VisibilityOutlined from '@mui/icons-material/VisibilityOutlined';
|
||||||
import type { PagedResult } from '@/api/client';
|
import type { PagedResult } from '@/api/client';
|
||||||
import { CopyCell } from '@/components/DataGrid';
|
|
||||||
import { LoadingBanner } from '@/components/LoadingBanner';
|
import { LoadingBanner } from '@/components/LoadingBanner';
|
||||||
import { SectionPaper } from '@/components/SectionPaper';
|
import { SectionPaper } from '@/components/SectionPaper';
|
||||||
import { SectionTitle } from '@/components/SectionTitle';
|
import { SectionTitle } from '@/components/SectionTitle';
|
||||||
|
|
@ -61,14 +60,14 @@ export function TripsTable(p: {
|
||||||
)}
|
)}
|
||||||
{rows.map((r) => (
|
{rows.map((r) => (
|
||||||
<TableRow key={r.id} hover={!!p.onOpen} onClick={p.onOpen ? () => p.onOpen!(r) : undefined} sx={{ cursor: p.onOpen ? 'pointer' : undefined }}>
|
<TableRow key={r.id} hover={!!p.onOpen} onClick={p.onOpen ? () => p.onOpen!(r) : undefined} sx={{ cursor: p.onOpen ? 'pointer' : undefined }}>
|
||||||
<TableCell sx={ltr}><CopyCell>{r.pn}</CopyCell></TableCell>
|
<TableCell sx={ltr}>{r.pn}</TableCell>
|
||||||
<TableCell sx={ltr}><CopyCell>{formatDate(r.paymentedDate)}</CopyCell></TableCell>
|
<TableCell sx={ltr}>{formatDate(r.paymentedDate)}</TableCell>
|
||||||
<TableCell sx={ltr}><CopyCell>{r.loadingNo}</CopyCell></TableCell>
|
<TableCell sx={ltr}>{r.loadingNo}</TableCell>
|
||||||
<TableCell sx={ltr}><CopyCell>{r.dischargeAuthoriztionNo}</CopyCell></TableCell>
|
<TableCell sx={ltr}>{r.dischargeAuthoriztionNo}</TableCell>
|
||||||
<TableCell sx={ltr}><CopyCell>{formatDate(r.dischargeEntryDate)}</CopyCell></TableCell>
|
<TableCell sx={ltr}>{formatDate(r.dischargeEntryDate)}</TableCell>
|
||||||
<TableCell sx={ltr}><CopyCell>{r.tn}</CopyCell></TableCell>
|
<TableCell sx={ltr}>{r.tn}</TableCell>
|
||||||
<TableCell sx={ltr}><CopyCell>{r.trn}</CopyCell></TableCell>
|
<TableCell sx={ltr}>{r.trn}</TableCell>
|
||||||
<TableCell sx={ltr}><CopyCell>{r.nnpn}</CopyCell></TableCell>
|
<TableCell sx={ltr}>{r.nnpn}</TableCell>
|
||||||
<TableCell><StatusChip value={r.statusCode} statuses={tripStatuses} /></TableCell>
|
<TableCell><StatusChip value={r.statusCode} statuses={tripStatuses} /></TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
))}
|
))}
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,6 @@ export const ui = {
|
||||||
'common.save': { en: 'Save', ar: 'حفظ' },
|
'common.save': { en: 'Save', ar: 'حفظ' },
|
||||||
'common.cancel': { en: 'Cancel', ar: 'إلغاء' },
|
'common.cancel': { en: 'Cancel', ar: 'إلغاء' },
|
||||||
'common.close': { en: 'Close', ar: 'إغلاق' },
|
'common.close': { en: 'Close', ar: 'إغلاق' },
|
||||||
'common.copy': { en: 'Copy', ar: 'نسخ' },
|
|
||||||
'common.back': { en: 'Back', ar: 'رجوع' },
|
'common.back': { en: 'Back', ar: 'رجوع' },
|
||||||
'common.next': { en: 'Next', ar: 'التالي' },
|
'common.next': { en: 'Next', ar: 'التالي' },
|
||||||
'common.edit': { en: 'Edit', ar: 'تعديل' },
|
'common.edit': { en: 'Edit', ar: 'تعديل' },
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue