paid & deposited

This commit is contained in:
Andreas Knuth 2026-02-20 11:47:06 -06:00
parent cbfbcf9b06
commit 4e6429e9ac
1 changed files with 4 additions and 6 deletions

View File

@ -2119,13 +2119,11 @@ app.post('/api/qbo/sync-payments', async (req, res) => {
// Prüfe ob in QBO bezahlt/teilweise bezahlt // Prüfe ob in QBO bezahlt/teilweise bezahlt
if (qboBalance === 0 && qboTotal > 0) { if (qboBalance === 0 && qboTotal > 0) {
// Voll bezahlt in QBO // Voll bezahlt in QBO
// Prüfe ob "Deposited" — dafür müssen wir LinkedTxn prüfen // Prüfe ob "Deposited" — DepositToAccountRef != Undeposited Funds (221)
// Wenn Deposit vorhanden → Deposited, sonst → Paid
let status = 'Paid'; let status = 'Paid';
const UNDEPOSITED_FUNDS_ID = '221';
// LinkedTxn aus der Invoice prüfen
if (qboInv.LinkedTxn) { if (qboInv.LinkedTxn) {
// Lade die Payments um zu prüfen ob sie deposited sind
for (const txn of qboInv.LinkedTxn) { for (const txn of qboInv.LinkedTxn) {
if (txn.TxnType === 'Payment') { if (txn.TxnType === 'Payment') {
try { try {
@ -2135,8 +2133,8 @@ app.post('/api/qbo/sync-payments', async (req, res) => {
}); });
const pmData = pmRes.getJson ? pmRes.getJson() : pmRes.json; const pmData = pmRes.getJson ? pmRes.getJson() : pmRes.json;
const payment = pmData.Payment; const payment = pmData.Payment;
if (payment && payment.DepositToAccountRef) { if (payment && payment.DepositToAccountRef &&
// Hat DepositToAccount → wurde deposited payment.DepositToAccountRef.value !== UNDEPOSITED_FUNDS_ID) {
status = 'Deposited'; status = 'Deposited';
} }
} catch (e) { /* ignore */ } } catch (e) { /* ignore */ }