Resumir tabla usando C # y JScript
He escrito código en C # para resumir los valores deInvoiceTable
y mover esos valores resumidos aGroupTable
en Abbyy FlexiCapture. El software es relativamente nuevo y no muestra ningún error cuando lo ejecuto.
Hay dos conjuntos de código para escribir:
En TechField.En EventHandlers.InvoiceTable
consiste en:
GroupTable
consiste en:
El código de EventHandlers es el siguiente (C #):
if (ChangedStates.Has(7)) {
int currentRow = 0;
int i;
for (i = 0; i < Document.Field("Invoice2\\InvoiceTable").Items.Count; i++) {
if (Document.Field("Invoice2\\InvoiceTable").Cell("TariffNumber", i).Value == "") {
Document.Field("Invoice2\\GroupTable").Cell("HSCode", currentRow).Value = Document.Field("Invoice2\\InvoiceTable").Cell("TariffNumber", i).Value;
Document.Field("Invoice2\\GroupTable").Cell("Amt", currentRow).Value = Document.Field("Invoice2\\InvoiceTable").Cell("Amount", i).Value;
Document.Field("Invoice2\\GroupTable").Cell("Qty", currentRow).Value = Document.Field("Invoice2\\InvoiceTable").Cell("ShipQty", i).Value;
currentRow++;
}
}
}
TechField es el siguiente (JScript):
for (i = 0; i < Field("ShipQty").Items.Count - 1; i++) {
for (j = i + 1; j < Field("ShipQty").Items.Count; j++) {
// if same new items are found
if (Field("TariffNumber").Items(i).Value == Field("TariffNumber").Items(j).Value && Field("CoO").Items(i).Value == Field("CoO").Items(j).Value)
{
// summarise quantities
Field("ShipQty").Items(i).Value = parseInt(Field("ShipQty").Items(i).Value) + parseInt(Field("ShipQty").Items(j).Value);
// and weights
Field("Amount").Items(i).Value = parseFloat(Field("Amount").Items(i).Value) + parseFloat(Field("Amount").Items(j).Value);
}
}
}
Condición:
En elInvoiceTable
donde seaTariffNumber
yCOO
son iguales, valores deShipQty
y Cantidad debe resumirse y ponerse enGroupTable
.
El código no muestra ningún error, pero tampoco proporciona el resultado. Sería genial si alguno de ustedes me puede ayudar en esto.