echo on
call :ReportFolderState "C:\FTPS\EXPORT"
Pause
@exit /b
:ReportFolderState
@call :CheckFolder "%~f1"
@set RESULT=%ERRORLEVEL%
@if %RESULT% equ 999 @echo Folder doesn't exist
@if %RESULT% equ 0 (@echo Folder is Empty!)
@if %RESULT% equ 1 goto Notempty
@exit /b
:CheckFolder
@if not exist "%~f1" @exit /b 999
@for %%I in (""%~f1"\*.*") do @exit /b 1
@exit /b 0
:Notempty
@echo Not Empty!
setlocal enableextensions
for %%a in ("%~f1\*.xml") do (
set "fileName=%%~na"
set "NamePath=%%~fa"
echo "%%~fa"
setlocal enabledelayedexpansion
goto Sendfile
)
exit /b
:SendFile
echo %Namepath%
@echo sending File!
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/command ^
"open ftpes://myftpsite.com" ^
"lcd ""%~f1""" ^
"cd /" ^
"put %Namepath%" ^
"exit"
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
move %Namepath% C:\FTPS\ARCHIVE
echo Uploaded Successfully
) else (
move %Namepath% C:\FTPS\ERROR
echo Error Uploading
)
exit /b %WINSCP_RESULT%
Thursday, July 11, 2019
Wednesday, July 10, 2019
Smartconnect - How to get Quantity Available from SQL before passing to Sales Line for Lot quantity without requiring override
'----------------------------------- CONFIGURATION -------------------------------------
Dim server As String = "TEST"
Dim database As String = "TEST"
Dim user As String = "test"
Dim password As String = "test"
Dim myItem As String = _ITEMNMBR
Dim mySite As String = _SITEID
Dim myQty as double = 0
'Dim myQtyString as string = ""
'---------------------------------------------------------------------------------------
'Declare the connection string based on the configuration variables
Dim conString As New String("Data Source=" & server & ";Initial Catalog=" & database & ";User=" & user & ";Password=" & password & ";")
'Define the query command to be run
Dim execute As String = "select qtyonhnd-atyalloc as qtyavlbl from iv00102 where itemnmbr = '" & myItem & "' and locncode = '" & mySite & "'"
'Microsoft.VisualBasic.MsgBox(execute)
'Define the SQL connection and open it
Dim myConn As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(conString)
myConn.Open()
'Declare the SQL command as the query string
Dim myCmd As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand(execute, myConn)
'Define the SQL Reader and execute it
Dim sqlReader As System.Data.SqlClient.SqlDataReader = myCmd.ExecuteReader()
sqlReader.Read()
myQty = Decimal.Parse(sqlReader("qtyavlbl"))
'myQtyString = sqlReader("qtyavlbl").ToString
IF _QUANTITY < myQty THEN
myQty = _QUANTITY
END IF
'Microsoft.VisualBasic.MsgBox(myQty)
'Microsoft.VisualBasic.MsgBox(myQtyString)
Return myQty
Dim server As String = "TEST"
Dim database As String = "TEST"
Dim user As String = "test"
Dim password As String = "test"
Dim myItem As String = _ITEMNMBR
Dim mySite As String = _SITEID
Dim myQty as double = 0
'Dim myQtyString as string = ""
'---------------------------------------------------------------------------------------
'Declare the connection string based on the configuration variables
Dim conString As New String("Data Source=" & server & ";Initial Catalog=" & database & ";User=" & user & ";Password=" & password & ";")
'Define the query command to be run
Dim execute As String = "select qtyonhnd-atyalloc as qtyavlbl from iv00102 where itemnmbr = '" & myItem & "' and locncode = '" & mySite & "'"
'Microsoft.VisualBasic.MsgBox(execute)
'Define the SQL connection and open it
Dim myConn As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(conString)
myConn.Open()
'Declare the SQL command as the query string
Dim myCmd As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand(execute, myConn)
'Define the SQL Reader and execute it
Dim sqlReader As System.Data.SqlClient.SqlDataReader = myCmd.ExecuteReader()
sqlReader.Read()
myQty = Decimal.Parse(sqlReader("qtyavlbl"))
'myQtyString = sqlReader("qtyavlbl").ToString
IF _QUANTITY < myQty THEN
myQty = _QUANTITY
END IF
'Microsoft.VisualBasic.MsgBox(myQty)
'Microsoft.VisualBasic.MsgBox(myQtyString)
Return myQty
Monday, July 8, 2019
Dynamics GP - Serial numbers are not available for selection, and the numbers cannot be used when attempting to adjust in
The numbers have already been used in the iv00200 table without proper receipt links
Find all records that are missing proper receipt links
select * from iv00200 where itemnmbr = 'myitemno' and RCTSEQNM <0
Delete the records from iv00200
Adjust the numbers back in using an inventory adjustment
Find all records that are missing proper receipt links
select * from iv00200 where itemnmbr = 'myitemno' and RCTSEQNM <0
Delete the records from iv00200
Adjust the numbers back in using an inventory adjustment
Thursday, July 4, 2019
NAV CAL - How to insert dimensions using Shortcut dimension field
GJL.VALIDATE(GJL."Shortcut Dimension 1 Code",MyDimensionValue);
This will work as long as it is the LAST field you validate on the journal entry.
If you attempt to validate any other fields after this line, it may remove the dimension that has already been validated.
This will work as long as it is the LAST field you validate on the journal entry.
If you attempt to validate any other fields after this line, it may remove the dimension that has already been validated.
NAV - How to setup Dimensions and Dimension Values
- Departments/Administration/Application Setup/Financial Management/Dimensions/Dimensions
- Customize Ribbon>Add Dimension Menu
- Click Dimension Values
Wednesday, July 3, 2019
NAV CAL - How to update or insert a record on a PO
UpdatePOLineToMatchAILine(AILine : Record "Advance Invoice Lines")
PH.SETRANGE("No.",AILine."PO Number");
ReleasePurchDoc.PerformManualReopen(PH);
IF PL.FIND('-') THEN BEGIN
PL.SETRANGE("Document No.",AILine."PO Number");
PL.SETRANGE("Line No.",AILine."PO Line");
IF PL.FIND('-') THEN BEGIN
//Modify existing PO Line
//PL.VALIDATE("Unit of Measure Code",AILine."Invoice UofM");
PL.VALIDATE(Quantity,AILine."Invoice Quantity");
PL.VALIDATE("Direct Unit Cost",AILine."Invoice Unit Price");
END ELSE BEGIN
//Insert new PO Line
PL.INIT;
PL.VALIDATE("Document Type",PH."Document Type");
PL.VALIDATE("Document No.",PH."No.");
PL.VALIDATE("Buy-from Vendor No.",PH."Buy-from Vendor No.");
PL.VALIDATE(Type,PL.Type::Item);
PL.VALIDATE("No.",AILine."Item Number");
PL.VALIDATE("Location Code",PH."Location Code");
PL.VALIDATE("Unit of Measure Code",AILine."Invoice UofM");
PL.VALIDATE(Quantity,AILine."Invoice Quantity");
PL.VALIDATE("Direct Unit Cost",AILine."Invoice Unit Price");
PL.INSERT;
END;
END;
ReleasePurchDoc.PerformManualRelease(PH);
PH.SETRANGE("No.",AILine."PO Number");
ReleasePurchDoc.PerformManualReopen(PH);
IF PL.FIND('-') THEN BEGIN
PL.SETRANGE("Document No.",AILine."PO Number");
PL.SETRANGE("Line No.",AILine."PO Line");
IF PL.FIND('-') THEN BEGIN
//Modify existing PO Line
//PL.VALIDATE("Unit of Measure Code",AILine."Invoice UofM");
PL.VALIDATE(Quantity,AILine."Invoice Quantity");
PL.VALIDATE("Direct Unit Cost",AILine."Invoice Unit Price");
END ELSE BEGIN
//Insert new PO Line
PL.INIT;
PL.VALIDATE("Document Type",PH."Document Type");
PL.VALIDATE("Document No.",PH."No.");
PL.VALIDATE("Buy-from Vendor No.",PH."Buy-from Vendor No.");
PL.VALIDATE(Type,PL.Type::Item);
PL.VALIDATE("No.",AILine."Item Number");
PL.VALIDATE("Location Code",PH."Location Code");
PL.VALIDATE("Unit of Measure Code",AILine."Invoice UofM");
PL.VALIDATE(Quantity,AILine."Invoice Quantity");
PL.VALIDATE("Direct Unit Cost",AILine."Invoice Unit Price");
PL.INSERT;
END;
END;
ReleasePurchDoc.PerformManualRelease(PH);
Subscribe to:
Posts (Atom)