Dataport 2
Dataport 2
{
OBJECT-PROPERTIES
{
Date=17-04-08;
Time=02:14:06;
Modified=Yes;
Version List=NAVNO4.00,NP;
}
PROPERTIES
{
CaptionML=[ENU=Import Huldt & Lillevik;
NOR=Importer Huldt & Lillevik];
FileFormat=Fixed;
OnInitDataport=BEGIN
// NIOH apr08 >>
GLSetup.GET;
GLSetup.TESTFIELD("Shortcut Dimension 1 Code",'DIVISJON');
GLSetup.TESTFIELD("Shortcut Dimension 3 Code",'AVDELING');
DimValue.SETFILTER(Code,STRSUBSTNO('%1*','SKARP'));
DimValue.FIND('-');
DivCodeSkarp := DimValue.Code;
// NIOH <<
END;
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=BEGIN
IF PostDate = 0D THEN
ERROR(Text001);
IF Filename = '' THEN
ERROR(Text002);
COMMIT;
PayrollTools.CheckJournal(NextLine,DefGenJnlLine);
NextLine := 10000;
END;
OnAfterImportRecord=BEGIN
// Delete leading zeros
ImportAccountNo := DELCHR(ImportAccountNo,'<','0');
ImportGlDimCode1 := DELCHR(ImportGlDimCode1,'<','0');
ImportGlDimCode2 := DELCHR(ImportGlDimCode2,'<','0');
IF ImportSign = '-' THEN
ImportAmount := -ImportAmount / 100
ELSE
ImportAmount := ImportAmount / 100;
// NIOH >>
//InsertJournalLine;
InsertJnlLine_Krohne;
// NIOH <<
END;
}
FIELDS
{
{ 1 ;7 ;ImportAccountNo ;CaptionML=[ENU=ImportAccountNo;
NOR=Importer kontonr.] }
{ 8 ;7 ;ImportGlDimCode1 ;CaptionML=[ENU=Import GlDimCode1;
NOR=Importer finansdim.kode1]
}
{ 15 ;8 ;ImportGlDimCode2 ;CaptionML=[ENU=Import GlDimCode2;
NOR=Importer finansdim.kode2]
}
{ 60 ;10 ;ImportNumber ;CaptionML=[ENU=ImportNumber;
NOR=Importnummer] }
{ 80 ;1 ;ImportSign ;CaptionML=[ENU=ImportSign;
NOR=Importtegn] }
{ 81 ;9 ;ImportAmount ;CaptionML=[ENU=ImportAmount;
NOR=Importbel�p] }
}
}
}
REQUESTFORM
{
PROPERTIES
{
Width=12210;
Height=1980;
SaveValues=Yes;
OnOpenForm=BEGIN
PayrollSetup.GET;
Filename := PayrollSetup."File Name";
PostDate := WORKDATE;
IF DocumentText = '' THEN
DocumentText := Text003;
END;
}
CONTROLS
{
{ 1 ;TextBox ;3520 ;1320 ;5500 ;440 ;AssistEdit=Yes;
CaptionML=[ENU=File Name;
NOR=Filnavn];
SourceExpr=Filename }
{ 2 ;Label ;110 ;1320 ;3300 ;440 ;ParentControl=1 }
{ 5 ;TextBox ;3520 ;110 ;1650 ;440 ;CaptionML=[ENU=Posting date;
NOR=Bokf�ringsdato];
SourceExpr=PostDate }
{ 6 ;Label ;110 ;110 ;3300 ;440 ;ParentControl=5 }
{ 9 ;TextBox ;3520 ;660 ;5500 ;440 ;CaptionML=[ENU=Document text;
NOR=Bilagstekst];
SourceExpr=DocumentText }
{ 8 ;Label ;110 ;660 ;3300 ;440 ;ParentControl=9 }
}
}
CODE
{
VAR
PayrollSetup@1000000001 : Record 15000200;
GenJnlLine@1000000002 : Record 81;
DefGenJnlLine@1000000003 : Record 81;
PrevGenJnlLine@1000000000 : Record 81;
PayrollTools@1000000004 : Codeunit 15000200;
PostDate@1000000005 : Date;
DocumentText@1000000006 : Text[50];
Filename@1000000007 : Text[250];
WorkfileName@1000000008 : Text[250];
NextLine@1000000009 : Integer;
ImportAccountNo@1000000010 : Code[20];
ImportGlDimCode1@1000000011 : Code[10];
ImportGlDimCode2@1000000012 : Code[10];
ImportNumber@1000000013 : Integer;
ImportAmount@1000000014 : Decimal;
ImportSign@1000000015 : Code[1];
Text001@1000000017 : TextConst 'ENU=Please specify Posting Date;NOR=Angi
bokf�ringsdato';
Text002@1080000 : TextConst 'ENU=Please specify File Name;NOR=Angi filnavn';
Text003@1080001 : TextConst 'ENU=Payroll;NOR=L�nnskostnad';
GLSetup@1000000018 : Record 98;
DimValue@1000000016 : Record 349;
JnlLineDim@1000000019 : Record 356;
DivCodeInstr@1000000022 : Code[20];
DivCodeSkarp@1000000021 : Code[20];
// NIOH >>
IF STRLEN(ImportGlDimCode1) = 3 THEN
"Gen. Journal Line".VALIDATE("Shortcut Dimension 1 Code",DivCodeInstr)
ELSE IF STRLEN(ImportGlDimCode1) = 4 THEN
"Gen. Journal Line".VALIDATE("Shortcut Dimension 1 Code",DivCodeSkarp);
// NIOH <<
// NIOH >>
IF ImportGlDimCode1 <> '' THEN BEGIN
JnlLineDim.INIT;
JnlLineDim."Table ID" := 81;
JnlLineDim."Journal Template Name" := "Gen. Journal Line"."Journal Template
Name";
JnlLineDim."Journal Batch Name" := "Gen. Journal Line"."Journal Batch
Name";
JnlLineDim."Journal Line No." := "Gen. Journal Line"."Line No.";
JnlLineDim."Dimension Code" := GLSetup."Shortcut Dimension 3 Code";
JnlLineDim."Dimension Value Code" := ImportGlDimCode1;
JnlLineDim.INSERT;
END;
// NIOH <<
END;
BEGIN
{
NIOH apr. 08: Endret Department til Dimension 3
}
END.
}
}