Project

General

Profile

Revision f4a16f5b src/libs/plugins/imexporters/yellownet/yellownet.c

View differences:

src/libs/plugins/imexporters/yellownet/yellownet.c
167 167

  
168 168

  
169 169

  
170
GWEN_TIME *AB_ImExporterYN__ReadTime(AB_IMEXPORTER *ie,
171
				     GWEN_XMLNODE *node,
172
				     int value) {
173
  GWEN_XMLNODE *n;
174
  GWEN_TIME *ti=0;
175

  
176
  n=GWEN_XMLNode_GetNodeByXPath(node, "C507",
177
				GWEN_PATH_FLAGS_NAMEMUSTEXIST);
178
  if (n) {
179
    GWEN_XMLNODE *nn;
180
    int v=0;
181

  
182
    nn=GWEN_XMLNode_FindFirstTag(n, "D_2005", 0, 0);
183
    if (nn)
184
      v=atoi(GWEN_XMLNode_GetProperty(nn, "Value", "0"));
185

  
186
    if (value==0 || v==value) {
187
      const char *s;
188

  
189
      s=GWEN_XMLNode_GetCharValue(n, "D_2380", 0);
190
      if (s)
191
	ti=AB_ImExporter_DateFromString(s, "YYYYMMDD", 0);
192
    }
193
  }
194

  
195
  return ti;
196
}
197

  
198

  
199

  
200 170
GWEN_DATE *AB_ImExporterYN__ReadDate(AB_IMEXPORTER *ie, GWEN_XMLNODE *node, int value) {
201 171
  GWEN_XMLNODE *n;
202 172
  GWEN_DATE *da=NULL;
......
360 330
      s=GWEN_XMLNode_GetProperty(nn, "Value", 0);
361 331
      if (s && strcasecmp(s, "LEN")==0) {
362 332
	GWEN_XMLNODE *nnn;
363
	GWEN_TIME *ti=0;
333
        GWEN_DATE *dt=0;
364 334
        AB_VALUE *val=0;
365 335

  
366 336
        /* read time */
367
	nnn=GWEN_XMLNode_GetNodeByXPath(n, "SG5/DTM",
368
					GWEN_PATH_FLAGS_NAMEMUSTEXIST);
337
	nnn=GWEN_XMLNode_GetNodeByXPath(n, "SG5/DTM", GWEN_PATH_FLAGS_NAMEMUSTEXIST);
369 338
	if (nnn)
370
	  ti=AB_ImExporterYN__ReadTime(ie, nnn, 202);
339
          dt=AB_ImExporterYN__ReadDate(ie, nnn, 202);
371 340

  
372 341
	/* read value */
373 342
	nnn=GWEN_XMLNode_GetNodeByXPath(n, "SG5/MOA",
......
376 345
	  val=AB_ImExporterYN__ReadValue(ie, nnn, 343);
377 346

  
378 347
	if (val) {
379
	  AB_ACCOUNT_STATUS *ast;
380 348
	  AB_BALANCE *bal;
381 349

  
382 350
          AB_Value_SetCurrency(val, AB_ImExporterAccountInfo_GetCurrency(ai));
383
	  ast=AB_AccountStatus_new();
384 351
          bal=AB_Balance_new();
385
          AB_Balance_SetTime(bal, ti);
352
          AB_Balance_SetType(bal, AB_Balance_TypeBooked);
353
          AB_Balance_SetDate(bal, dt);
386 354
          AB_Balance_SetValue(bal, val);
387

  
388
	  AB_AccountStatus_SetBookedBalance(ast, bal);
389
	  AB_Balance_free(bal);
390

  
391
	  AB_ImExporterAccountInfo_AddAccountStatus(ai, ast);
392
	}
355
          AB_ImExporterAccountInfo_AddBalance(ai, bal);
356
        }
393 357
	AB_Value_free(val);
394
        GWEN_Time_free(ti);
358
        GWEN_Date_free(dt);
395 359
      }
396 360
    }
397 361

  

Also available in: Unified diff