В методе TransferInventTransOrigin таблицы InventTrans есть код, который вычисяет номер лота связанной проводки переноса (по отношению к текущей проводке):
X++:
// don't combine the statements below as that most likely results in wide index scans instead of narrow index seeks.
if (this.Qty <= 0)
{ // This is most likely the standard issue of a transfer so try that first.
select firstonly inventTransOrigin
exists join inventTransOriginTransfer
where inventTransOriginTransfer.IssueInventTransOrigin == this.InventTransOrigin
&& inventTransOriginTransfer.ReceiptInventTransOrigin == inventTransOrigin.RecId;
if (!inventTransOrigin.RecId)
{ // This wasn't the issue - try the receipt
select firstonly inventTransOrigin
exists join inventTransOriginTransfer
where inventTransOriginTransfer.IssueInventTransOrigin == inventTransOrigin.RecId
&& inventTransOriginTransfer.ReceiptInventTransOrigin == this.InventTransOrigin;
}
}
else
{ // This is most likely the standard receipt of a transfer so try that first.
select firstonly inventTransOrigin
exists join inventTransOriginTransfer
where inventTransOriginTransfer.IssueInventTransOrigin == inventTransOrigin.RecId
&& inventTransOriginTransfer.ReceiptInventTransOrigin == this.InventTransOrigin;
if (!inventTransOrigin.RecId)
{ // This wasn't the receipt - try the issue
select firstonly inventTransOrigin
exists join inventTransOriginTransfer
where inventTransOriginTransfer.IssueInventTransOrigin == this.InventTransOrigin
&& inventTransOriginTransfer.ReceiptInventTransOrigin == inventTransOrigin.RecId;
}
}
У меня вопрос, как могут быть проводки расхода с положительным знаком или проводки прихода с отрицательным? Дело в том, что для OLAP мне необходимо реализовать связь проводок переноса с помощь view и не хотелось бы ненужных усложнений.