0% found this document useful (0 votes)
9 views4 pages

Dataport

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views4 pages

Dataport

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

OBJECT Dataport 15000250 Import Hogia Windows Payroll

{
OBJECT-PROPERTIES
{
Date=02-07-04;
Time=12:00:00;
Version List=NAVNO4.00;
}
PROPERTIES
{
CaptionML=[ENU=Import Hogia Windowsl�nn;
NOR=Importer Hogia Windowsl�nn];
OnPreDataport=BEGIN
// Create workfile
WorkfileName := PayrollTools.CreateWorkfile(Filename);
CurrDataport.FILENAME(WorkfileName);
END;

OnPostDataport=BEGIN
IF PayrollSetup."Save Payroll File" THEN
PayrollTools.NewFilename(Filename);
END;

}
DATAITEMS
{
{ PROPERTIES
{
DataItemTable=Table81;
AutoSave=No;
AutoUpdate=No;
DataItemTableView=SORTING(Journal Template Name,Journal Batch Name,Line
No.);
OnPreDataItem=VAR
text001@1000000000 : TextConst 'ENU=Specify document
date;NOR=Angi bilagsdato';
text002@1000000001 : TextConst 'ENU=Specify file
name;NOR=Angi filnavn';
BEGIN
IF PayrollDocumentDate = 0D THEN
ERROR(text001);
IF Filename = '' THEN
ERROR(text002);

COMMIT;
PayrollTools.CheckJournal(NextLine,DefGenJnlLine);
NextLine := 10000;
END;

OnAfterImportRecord=BEGIN
Posttype := COPYSTR(ImportText,1,3);
CASE Posttype OF
'001': ManagePosttype1;
'002': BEGIN
ManagePosttype2;
InsertJournalLine;
END;
END;
END;
}
FIELDS
{
{ ; ;ImportText }
}
}
}
REQUESTFORM
{
PROPERTIES
{
Width=8910;
Height=2860;
CaptionML=[ENU=Import Hogia Windows Payroll;
NOR=Importer l�nnskostnad for Hogia Windows];
SaveValues=Yes;
OnOpenForm=BEGIN
PayrollSetup.GET;
Filename := PayrollSetup."File Name";
PayrollDocumentDate := WORKDATE;
IF DocumentText = '' THEN
DocumentText := Text001;
END;

}
CONTROLS
{
{ 1 ;TextBox ;3410 ;2420 ;5500 ;440 ;AssistEdit=Yes;
CaptionML=[ENU=Filename;
NOR=Filnavn];
SourceExpr=Filename }
{ 2 ;Label ;0 ;2420 ;3300 ;440 ;ParentControl=1 }
{ 4 ;OptionButton ;3410 ;1100 ;1650 ;440 ;CaptionML=[ENU=Manual:;
NOR=Manuelt:];
SourceExpr=DocumentTextType;
OptionValue=Manual }
{ 9 ;TextBox ;3410 ;1650 ;5500 ;440 ;CaptionML=[ENU=Document text;
NOR=Bilagstekst];
SourceExpr=DocumentText }
{ 3 ;OptionButton ;3410 ;550 ;3080 ;440 ;CaptionML=[ENU=Automatic;
NOR=Automatisk];
SourceExpr=DocumentTextType;
OptionValue=Automatic }
{ 8 ;Label ;0 ;550 ;3300 ;440 ;CaptionML=[ENU=Document text;
NOR=Bilagstekst] }
{ 5 ;TextBox ;3410 ;0 ;1650 ;440 ;CaptionML=[ENU=Document date;
NOR=Bilagsdato];
SourceExpr=PayrollDocumentDate }
{ 6 ;Label ;0 ;0 ;3300 ;440 ;ParentControl=5;
CaptionML=[ENU=Document Date;
NOR=Bilagsdato] }
}
}
CODE
{
VAR
TempGenJnlLine@1000000000 : TEMPORARY Record 81;
PayrollSetup@1000000001 : Record 15000200;
GenJnlLine@1000000002 : Record 81;
DefGenJnlLine@1000000003 : Record 81;
PrevGenJnlLine@1000000020 : Record 81;
PayrollTools@1000000004 : Codeunit 15000200;
PayrollDocumentDate@1000000005 : Date;
DocumentText@1000000006 : Text[50];
DocumentTextType@1000000007 : 'Automatic,Manual';
Filename@1000000008 : Text[250];
WorkfileName@1000000009 : Text[250];
NextLine@1000000010 : Integer;
Posttype@1000000011 : Text[3];
ImportText@1000000012 : Text[250];
ImportAccountNo@1000000013 : Code[20];
ImportDate@1000000014 : Date;
ImportDocumentText@1000000015 : Text[50];
ImportGlDimCode1@1000000016 : Code[10];
ImportGlDimCode2@1000000017 : Code[10];
ImportAmount@1000000018 : Decimal;
AmountText@1000000019 : Text[30];
Text001@1080000 : TextConst 'ENU=Payroll;NOR=L�nnskostnad';

PROCEDURE Initialize@1(SetGenJnlLine@1000000000 : Record 81);


BEGIN
// Set the def. journal for import
DefGenJnlLine := SetGenJnlLine;
END;

LOCAL PROCEDURE ManagePosttype1@2();


BEGIN
EVALUATE(ImportDate,COPYSTR(ImportText,4,8));
ImportDocumentText := COPYSTR(ImportText,32,12);
END;

LOCAL PROCEDURE ManagePosttype2@3();


BEGIN
// DELCHR deletes leading zeros
ImportGlDimCode1 := DELCHR(COPYSTR(ImportText,33,9),'<','0');
ImportGlDimCode2 := DELCHR(COPYSTR(ImportText,61,9),'<','0');
ImportAccountNo := DELCHR(COPYSTR(ImportText,42,9),'<','0');
AmountText := COPYSTR(ImportText,100,20); // The decimal separator is a full
stop
AmountText := CONVERTSTR(AmountText,'.',',');
EVALUATE(ImportAmount,AmountText);
END;

LOCAL PROCEDURE InsertJournalLine@4();


BEGIN
PrevGenJnlLine := "Gen. Journal Line";
CLEAR("Gen. Journal Line");
"Gen. Journal Line".VALIDATE("Journal Template Name",DefGenJnlLine."Journal
Template Name");
"Gen. Journal Line".VALIDATE("Journal Batch Name",DefGenJnlLine."Journal
Batch Name");
"Gen. Journal Line".SetUpNewLine(PrevGenJnlLine,0,FALSE);
"Gen. Journal Line".VALIDATE("Line No.",NextLine);
NextLine := NextLine + 10000;
"Gen. Journal Line".VALIDATE("Account Type","Gen. Journal Line"."Account
Type"::"G/L Account");
"Gen. Journal Line".VALIDATE("Posting Date",ImportDate);
"Gen. Journal Line".VALIDATE("Document Date",PayrollDocumentDate);
"Gen. Journal Line".VALIDATE("Account No.",ImportAccountNo);
// Amount in LCY/100 to LCY:
"Gen. Journal Line".VALIDATE(Amount,ImportAmount);
IF DocumentTextType = DocumentTextType::Manual THEN
"Gen. Journal Line".VALIDATE(Description,DocumentText)
ELSE
"Gen. Journal Line".VALIDATE(Description,ImportDocumentText);

IF PayrollSetup."Import Department and Project" THEN BEGIN


"Gen. Journal Line".VALIDATE("Shortcut Dimension 1 Code",ImportGlDimCode1);
"Gen. Journal Line".VALIDATE("Shortcut Dimension 2 Code",ImportGlDimCode2);
END;
"Gen. Journal Line".INSERT;
END;

BEGIN
END.
}
}

You might also like