Changeset 11
- Timestamp:
- Jul 13, 2011, 2:20:53 PM (13 years ago)
- Location:
- import/navision_csv
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
import/navision_csv/UMainForm.lfm
r10 r11 15 15 Width = 574 16 16 Anchors = [akTop, akLeft, akRight, akBottom] 17 ScrollBars = ssAutoBoth 17 18 TabOrder = 0 18 19 end -
import/navision_csv/UMainForm.pas
r10 r11 18 18 { private declarations } 19 19 public 20 { public declarations }20 function CheckVAT(VAT: string): Boolean; 21 21 end; 22 22 … … 34 34 Source, Dest: TStringList; 35 35 I: Integer; 36 P: Integer; 36 37 DestLine: TStringList; 37 38 Line: TStringList; 39 VAT: string; 38 40 begin 39 41 try … … 50 52 DestLine.Add('address/city'); 51 53 DestLine.Add('vatin'); 52 DestLine.Add('vat');54 //DestLine.Add('vat'); 53 55 DestLine.Add('address/zip'); 54 DestLine.Add('address/country_id');56 //DestLine.Add('address/country_id'); 55 57 DestLine.Add('address/phone'); 56 58 DestLine.Add('address/fax'); … … 58 60 Dest.Add(DestLine.CommaText); 59 61 60 for I := 0to Source.Count - 1 do begin62 for I := 1 to Source.Count - 1 do begin 61 63 DestLine.Clear; 62 64 Line.CommaText := Source[I]; 65 66 //VAT := Trim(Line[8]); 67 //if not CheckVAT(VAT) then VAT := ''; 68 63 69 DestLine.Add('' + Line[3] + ''); 64 70 DestLine.Add('' + Line[4] + ''); … … 66 72 DestLine.Add('' + Line[6] + ''); 67 73 DestLine.Add('' + Line[7] + ''); 68 DestLine.Add('' + Line[8]+ '');74 //DestLine.Add('' + VAT + ''); 69 75 DestLine.Add('' + Line[14] + ''); 70 DestLine.Add('' + Line[15] + '');76 //DestLine.Add('' + Line[15] + ''); 71 77 DestLine.Add('' + Line[16] + ''); 72 78 DestLine.Add('' + Line[17] + ''); … … 83 89 end; 84 90 91 function TForm1.CheckVAT(VAT: string): Boolean; 92 var 93 VATNum: string; 94 Checksum: Integer; 95 VATChecksum: Integer; 96 P: Integer; 97 begin 98 VATNum := ''; 99 Checksum := 0; 100 101 P := 1; 102 while (P < Length(VAT)) and not ((VAT[P] >= '0') and (VAT[P] <= '9')) do Inc(P); 103 if (P < Length(VAT)) then VATNum := Copy(VAT, P, 255); 104 Memo1.Lines.Add(VAT + ': ' + IntToStr(P) + ': ' + VATNum); 105 VATChecksum := StrToInt(Copy(VATNum, Length(VATNum) - 1, 2)); 106 VATNum := Copy(VATNum, 1, Length(VATNum) - 2); 107 if VATNum <> '' then begin 108 for P := 1 to Length(VATNum) do begin 109 if P > 7 then begin 110 Result := False; 111 Break; 112 end; 113 Checksum := Checksum + StrToInt(VATNum[P]) * (9 - P); 114 end; 115 while Checksum >= 0 do Checksum := Checksum - 97; 116 Result := Abs(CheckSum) = VATChecksum; 117 end else Result := False; 118 end; 119 85 120 end. 86 121 -
import/navision_csv/navision_csv.lpi
r10 r11 40 40 <IsPartOfProject Value="True"/> 41 41 <UnitName Value="navision_csv"/> 42 <UsageCount Value="2 0"/>42 <UsageCount Value="21"/> 43 43 </Unit0> 44 44 <Unit1> … … 51 51 <EditorIndex Value="0"/> 52 52 <WindowIndex Value="0"/> 53 <TopLine Value=" 26"/>54 <CursorPos X=" 21" Y="44"/>55 <UsageCount Value="2 0"/>53 <TopLine Value="85"/> 54 <CursorPos X="51" Y="97"/> 55 <UsageCount Value="21"/> 56 56 <Loaded Value="True"/> 57 57 <LoadedDesigner Value="True"/> 58 58 </Unit1> 59 59 </Units> 60 <JumpHistory Count="0" HistoryIndex="-1"/> 60 <JumpHistory Count="30" HistoryIndex="29"> 61 <Position1> 62 <Filename Value="UMainForm.pas"/> 63 <Caret Line="20" Column="26" TopLine="20"/> 64 </Position1> 65 <Position2> 66 <Filename Value="UMainForm.pas"/> 67 <Caret Line="96" Column="1" TopLine="84"/> 68 </Position2> 69 <Position3> 70 <Filename Value="UMainForm.pas"/> 71 <Caret Line="97" Column="1" TopLine="84"/> 72 </Position3> 73 <Position4> 74 <Filename Value="UMainForm.pas"/> 75 <Caret Line="98" Column="1" TopLine="84"/> 76 </Position4> 77 <Position5> 78 <Filename Value="UMainForm.pas"/> 79 <Caret Line="100" Column="1" TopLine="84"/> 80 </Position5> 81 <Position6> 82 <Filename Value="UMainForm.pas"/> 83 <Caret Line="101" Column="1" TopLine="84"/> 84 </Position6> 85 <Position7> 86 <Filename Value="UMainForm.pas"/> 87 <Caret Line="102" Column="1" TopLine="84"/> 88 </Position7> 89 <Position8> 90 <Filename Value="UMainForm.pas"/> 91 <Caret Line="103" Column="1" TopLine="84"/> 92 </Position8> 93 <Position9> 94 <Filename Value="UMainForm.pas"/> 95 <Caret Line="104" Column="1" TopLine="84"/> 96 </Position9> 97 <Position10> 98 <Filename Value="UMainForm.pas"/> 99 <Caret Line="105" Column="47" TopLine="85"/> 100 </Position10> 101 <Position11> 102 <Filename Value="UMainForm.pas"/> 103 <Caret Line="106" Column="1" TopLine="86"/> 104 </Position11> 105 <Position12> 106 <Filename Value="UMainForm.pas"/> 107 <Caret Line="96" Column="1" TopLine="86"/> 108 </Position12> 109 <Position13> 110 <Filename Value="UMainForm.pas"/> 111 <Caret Line="97" Column="1" TopLine="86"/> 112 </Position13> 113 <Position14> 114 <Filename Value="UMainForm.pas"/> 115 <Caret Line="98" Column="1" TopLine="86"/> 116 </Position14> 117 <Position15> 118 <Filename Value="UMainForm.pas"/> 119 <Caret Line="100" Column="1" TopLine="86"/> 120 </Position15> 121 <Position16> 122 <Filename Value="UMainForm.pas"/> 123 <Caret Line="101" Column="1" TopLine="86"/> 124 </Position16> 125 <Position17> 126 <Filename Value="UMainForm.pas"/> 127 <Caret Line="102" Column="1" TopLine="86"/> 128 </Position17> 129 <Position18> 130 <Filename Value="UMainForm.pas"/> 131 <Caret Line="103" Column="1" TopLine="86"/> 132 </Position18> 133 <Position19> 134 <Filename Value="UMainForm.pas"/> 135 <Caret Line="104" Column="1" TopLine="86"/> 136 </Position19> 137 <Position20> 138 <Filename Value="UMainForm.pas"/> 139 <Caret Line="105" Column="1" TopLine="86"/> 140 </Position20> 141 <Position21> 142 <Filename Value="UMainForm.pas"/> 143 <Caret Line="106" Column="1" TopLine="86"/> 144 </Position21> 145 <Position22> 146 <Filename Value="UMainForm.pas"/> 147 <Caret Line="107" Column="1" TopLine="90"/> 148 </Position22> 149 <Position23> 150 <Filename Value="UMainForm.pas"/> 151 <Caret Line="108" Column="1" TopLine="90"/> 152 </Position23> 153 <Position24> 154 <Filename Value="UMainForm.pas"/> 155 <Caret Line="112" Column="1" TopLine="92"/> 156 </Position24> 157 <Position25> 158 <Filename Value="UMainForm.pas"/> 159 <Caret Line="108" Column="1" TopLine="92"/> 160 </Position25> 161 <Position26> 162 <Filename Value="UMainForm.pas"/> 163 <Caret Line="112" Column="1" TopLine="92"/> 164 </Position26> 165 <Position27> 166 <Filename Value="UMainForm.pas"/> 167 <Caret Line="114" Column="1" TopLine="94"/> 168 </Position27> 169 <Position28> 170 <Filename Value="UMainForm.pas"/> 171 <Caret Line="115" Column="28" TopLine="97"/> 172 </Position28> 173 <Position29> 174 <Filename Value="UMainForm.pas"/> 175 <Caret Line="96" Column="1" TopLine="84"/> 176 </Position29> 177 <Position30> 178 <Filename Value="UMainForm.pas"/> 179 <Caret Line="68" Column="7" TopLine="45"/> 180 </Position30> 181 </JumpHistory> 61 182 </ProjectOptions> 62 183 <CompilerOptions>
Note:
See TracChangeset
for help on using the changeset viewer.