Patch level : 12.0 1048

Files correlati     : bs0.EXE correzioni spaziature e riporti su  velib04
Commento        :

Inserimento primi riporti su soluzione BS
This commit is contained in:
Francesco_Fucarino 2021-04-06 15:10:36 +02:00
parent 33056952ae
commit 19f3713235
16 changed files with 610 additions and 564 deletions

View File

@ -1,12 +1,18 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.1340
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bs0", "bs0.vcxproj", "{9C91BACF-9A70-4973-B8CC-FA3D2AF9867C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AgaLib", "AgaLib.vcxproj", "{2D38A763-3D74-4338-9362-B891784EC90E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vedoc", "vedoc.vcxproj", "{A1CE9743-A597-4F92-B55A-345A366C9E55}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cglib", "cglib.vcxproj", "{7B80F974-CE2E-4BD9-855A-44FF139FF288}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vedocext", "vedocext.vcxproj", "{0042619A-6B7C-4D3D-9CD9-9BDD8D200C15}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@ -25,8 +31,19 @@ Global
{A1CE9743-A597-4F92-B55A-345A366C9E55}.Debug|Win32.Build.0 = Debug|Win32
{A1CE9743-A597-4F92-B55A-345A366C9E55}.Release|Win32.ActiveCfg = Release|Win32
{A1CE9743-A597-4F92-B55A-345A366C9E55}.Release|Win32.Build.0 = Release|Win32
{7B80F974-CE2E-4BD9-855A-44FF139FF288}.Debug|Win32.ActiveCfg = Debug|Win32
{7B80F974-CE2E-4BD9-855A-44FF139FF288}.Debug|Win32.Build.0 = Debug|Win32
{7B80F974-CE2E-4BD9-855A-44FF139FF288}.Release|Win32.ActiveCfg = Release|Win32
{7B80F974-CE2E-4BD9-855A-44FF139FF288}.Release|Win32.Build.0 = Release|Win32
{0042619A-6B7C-4D3D-9CD9-9BDD8D200C15}.Debug|Win32.ActiveCfg = Debug|Win32
{0042619A-6B7C-4D3D-9CD9-9BDD8D200C15}.Debug|Win32.Build.0 = Debug|Win32
{0042619A-6B7C-4D3D-9CD9-9BDD8D200C15}.Release|Win32.ActiveCfg = Release|Win32
{0042619A-6B7C-4D3D-9CD9-9BDD8D200C15}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9378D194-8834-42B8-AF00-8CFF5D4B42E8}
EndGlobalSection
EndGlobal

View File

@ -212,9 +212,15 @@
<ProjectReference Include="AgaLib.vcxproj">
<Project>{2d38a763-3d74-4338-9362-b891784ec90e}</Project>
</ProjectReference>
<ProjectReference Include="cglib.vcxproj">
<Project>{7b80f974-ce2e-4bd9-855a-44ff139ff288}</Project>
</ProjectReference>
<ProjectReference Include="vedoc.vcxproj">
<Project>{a1ce9743-a597-4f92-b55a-345a366c9e55}</Project>
</ProjectReference>
<ProjectReference Include="vedocext.vcxproj">
<Project>{0042619a-6b7c-4d3d-9cd9-9bdd8d200c15}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -229,55 +229,45 @@
<ItemGroup>
<SqlCompiler Include="..\src\fp\sql\fp0100.sql">
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</SqlCompiler>
<SqlCompiler Include="..\src\fp\sql\fp0104.sql">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</SqlCompiler>
<SqlCompiler Include="..\src\fp\sql\fp0106.sql">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</SqlCompiler>
<SqlCompiler Include="..\src\fp\sql\fp0108.sql">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</SqlCompiler>
<SqlCompiler Include="..\src\fp\sql\fp0110.sql">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</SqlCompiler>
<SqlCompiler Include="..\src\fp\sql\fp0112.sql">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</SqlCompiler>
<SqlCompiler Include="..\src\fp\sql\fp0114.sql">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</SqlCompiler>
<SqlCompiler Include="..\src\fp\sql\fp0116.sql">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</SqlCompiler>
<SqlCompiler Include="..\src\fp\sql\fp0118.sql">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</SqlCompiler>
</ItemGroup>
<ItemGroup>
<SqlCompiler Include="..\src\fp\sql\fp0102.sql">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</SqlCompiler>

View File

@ -6,10 +6,10 @@ int main(int argc, char** argv)
const int p = argc > 1 ? argv[1][1]-'0' : 0;
switch(p)
{
case 1: bs0200(argc, argv); break; // Impostazioni Beestore
case 1: bs0200(argc, argv); break; // Importazioni Beestore
case 2: bs0300(argc, argv); break; // Importazione da SKNET
case 3: bs0400(argc, argv); break; // Tabelle di transazione
default: bs0100(argc, argv); break; // Beestore Synchronizer
case 3: bs0400(argc, argv); break; // Tabelle di transazione
default: bs0100(argc, argv); break; // Trasferimento Beestore Impostazione
}
return 0;
}

View File

@ -1,5 +1,5 @@
#define F_DATASOURCE 101
#define F_USER 102
#define F_PASSWORD 103
#define F_ORIGINE 104
#define F_LOG 105
#define F_DATASOURCE 101
#define F_USER 102
#define F_PASSWORD 103
#define F_ORIGINE 104
#define F_LOG 105

View File

@ -150,8 +150,8 @@ typedef bool TFieldEvaluator(const TISAM_recordset& rec, const char* fldname, co
class TBeeStore_sync : public TSkeleton_application
{
TString _dsn;
TString _usr;
TString _psw;
TString _usr;
TString _psw;
TFilename _sqlog;
TLog_report* _log;
@ -184,11 +184,11 @@ protected:
void sync_anamag (const TDate& dal, const TDate& al);
void sync_barcode (const TDate& dal, const TDate& al);
void sync_corrisp (const TDate& dal, const TDate& al);
void sync_mov(int tipotestata, const TDate& dal, const TDate& al);
void sync_scontrini(const TDate& dal, const TDate& al) { sync_mov(3, dal, al);}
void sync_doc (const TDate& dal , const TDate& al);
void sync_carscar (const TDate& dal, const TDate& al) { sync_mov(1, dal, al);}
void sync_generici (const TDate& dal , const TDate& al) { sync_mov(4, dal, al);}
void sync_mov(int tipotestata, const TDate& dal, const TDate& al);
void sync_scontrini(const TDate& dal, const TDate& al) { sync_mov(3, dal, al);}
void sync_doc (const TDate& dal , const TDate& al);
void sync_carscar (const TDate& dal, const TDate& al) { sync_mov(1, dal, al);}
void sync_generici (const TDate& dal , const TDate& al) { sync_mov(4, dal, al);}
void sync_clifo (int cfmask, const TDate& dal, const TDate& al);
void sync_listino (const TString& listino);
@ -208,7 +208,7 @@ void TBeeStore_sync::load_origine_1(TISAM_recordset& out_set, const char* in_tab
str << "\nFROM " << in_table << " WHERE (Origine=1);";
TODBC_recordset odbc(str);
odbc.connect(_dsn, _usr, _psw);
odbc.connect(_dsn, _usr, _psw);
const TRecnotype n = odbc.items();
if (n > 0)
{
@ -340,7 +340,7 @@ void TBeeStore_sync::save_origine_2(TISAM_recordset& in_set, const char* out_tab
const TRecnotype n = in_set.items();
TString str(255);
TODBC_recordset odbc(str);
odbc.connect(_dsn, _usr, _psw);
odbc.connect(_dsn, _usr, _psw);
str.cut(0) << "DELETE FROM " << out_table << " WHERE Origine=2;";
odbc.exec(str);
@ -448,7 +448,7 @@ static TString& build_query(const char* table, const TDate& dal, const TDate& al
TString& q = get_tmp_string();
q << "USE " << table;
if (dal.ok() || al.ok())
q << "SELECT BETWEEN(DATAAGG," << dal.date2ansi() << ',' << al.date2ansi() << ")";
q << " SELECT BETWEEN(DATAAGG," << dal.date2ansi() << ',' << al.date2ansi() << ")";
return q;
}
@ -515,7 +515,7 @@ void TBeeStore_sync::sync_lines(const TDate& dal, const TDate& al)
fields.add("DSLinea|S0");
TString query = build_query("GMC", dal, al);
if (query.find("SELECT") < 0)
if (query.find(" SELECT") < 0)
query << " SELECT ";
else
query << "&&";
@ -930,7 +930,7 @@ void TBeeStore_sync::sync_clifo(int cfmask, const TDate& dal, const TDate& al)
TString str(255);
TODBC_recordset clifo(str);
clifo.connect(_dsn, _usr, _psw);
clifo.connect(_dsn, _usr, _psw);
str << "DELETE FROM tieAnagCFP WHERE Origine=1;";
clifo.exec(str); // Elimina tutte le anagrafiche importate da BeeStore
@ -966,7 +966,7 @@ bool TBeeStore_sync::save_and_delete_movmag(TMov_mag*& doc) const
bool TBeeStore_sync::save_and_delete_doc(TDocumento*& doc) const
{
int err = 0;
if (doc != NULL)
if (doc != nullptr)
{
if (doc->rows() > 0)
{
@ -983,8 +983,7 @@ bool TBeeStore_sync::save_and_delete_doc(TDocumento*& doc) const
err = 0;
}
}
delete doc;
doc = NULL;
safe_delete(doc);
}
return err == 0;
}
@ -1002,7 +1001,7 @@ void TBeeStore_sync::sync_listino(const TString& listino)
{
TString str(255);
TODBC_recordset prz(str);
prz.connect(_dsn, _usr, _psw);
prz.connect(_dsn, _usr, _psw);
str = "DELETE FROM tiePrzVendita WHERE Origine=1";
prz.exec(str); // Ignora tutti i listini di BeeStore

View File

@ -17,6 +17,10 @@
#define F_FORNITORI 116
#define F_BARCODE 117
#define F_BBDAL 121
#define F_BBAL 122
#define F_FATBOL 123
#define F_C_CARSCAR 201
#define F_D_CARSCAR 202
#define F_C_DOCUMENTI 203

View File

@ -132,6 +132,43 @@ END
ENDPAGE
PAGE "newpage_Boll_Fatt_Scontrini" 0 2 0 0
GROUPBOX DLG_NULL 78 5
BEGIN
PROMPT 1 1 "@bBolle"
END
DATE F_BBDAL
BEGIN
PROMPT 2 4 "Dalla data di modifica "
FIELD SyncDateFrom
END
DATE F_BBAL
BEGIN
PROMPT 42 4 " al "
FIELD SyncDateTo
END
BOOLEAN F_FATBOL
BEGIN
PROMPT 2 9 "FATT/BOLL"
FIELD SyncFatBol
END
GROUPBOX DLG_NULL 78 5
BEGIN
PROMPT 1 6 "@bFatture"
END
GROUPBOX DLG_NULL 78 5
BEGIN
PROMPT 1 11 "@bOrdini"
END
ENDPAGE
PAGE "Parametri" 0 2 0 0
GROUPBOX DLG_NULL 78 7

View File

@ -37,12 +37,6 @@
// Utility
///////////////////////////////////////////////////////////
const TString my_origin()
{
static const TString my_orig = ini_get_string(CONFIG_DITTA, "BS", "Origine", "2");
return my_orig;
}
const TString their_origin()
{
static const TString their_orig(1, (ini_get_int(CONFIG_DITTA, "BS", "Origine", 1) == 1 ? 2 : 1) + '0');

View File

@ -1,13 +1,13 @@
#define F_DAL 101
#define F_AL 102
#define F_DAL 101
#define F_AL 102
#define F_UMS 103
#define F_IVA 104
#define F_ART 105
#define F_DOCUMENTI 106
#define F_VALUTE 107
#define F_CLIENTI 108
#define F_FORNITORI 109
#define F_UMS 103
#define F_IVA 104
#define F_ART 105
#define F_DOCUMENTI 106
#define F_VALUTE 107
#define F_CLIENTI 108
#define F_FORNITORI 109
#define F_CODNUMBOL 201
#define F_TIPODOCBOL 202
@ -19,7 +19,7 @@
#define F_TIPODOCTAM 208
#define F_CODNUMORC 209
#define F_TIPODOCORC 210
#define F_OVERRIG 211
#define F_OVERRIG 211
#define F_NUMCUSTRIG 212
#define F_IMPORTUSER 213
#define F_EMPTYONIMP 214
@ -27,5 +27,5 @@
#define F_CODIVADEF 216
#define F_CODUMSDEF 217
#define F_C_CORRISPETTIVI 301
#define F_D_CORRISPETTIVI 302
#define F_C_CORRISPETTIVI 301
#define F_D_CORRISPETTIVI 302

View File

@ -58,155 +58,155 @@ BEGIN
PROMPT 1 6 "@bImpostazioni documenti"
END
STRING F_CODNUMBOL 4
BEGIN
PROMPT 2 7 "Numerazione bolle "
FIELD SKCODNUMBOL
HELP "Codice numerazione"
USE %NUM
INPUT CODTAB F_CODNUMBOL
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODNUMBOL CODTAB
FLAG "UPA"
WARNING "Numerazione assente"
KEY 1 2
STRING F_CODNUMBOL 4
BEGIN
PROMPT 2 7 "Numerazione bolle "
FIELD SKCODNUMBOL
HELP "Codice numerazione"
USE %NUM
INPUT CODTAB F_CODNUMBOL
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODNUMBOL CODTAB
FLAG "UPA"
WARNING "Numerazione assente"
KEY 1 2
END
STRING F_TIPODOCBOL 4
BEGIN
PROMPT 40 7 "Tipo bolle "
FIELD SKTIPODOCBOL
HELP "Codice tipo documento"
USE %TIP
INPUT CODTAB F_TIPODOCBOL
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_TIPODOCBOL CODTAB
FLAG "UP"
STRING F_TIPODOCBOL 4
BEGIN
PROMPT 40 7 "Tipo bolle "
FIELD SKTIPODOCBOL
HELP "Codice tipo documento"
USE %TIP
INPUT CODTAB F_TIPODOCBOL
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_TIPODOCBOL CODTAB
FLAG "UP"
END
STRING F_CODNUMFAT 4
BEGIN
PROMPT 2 8 "Numerazione fatture "
FIELD SKCODNUMFAT
HELP "Codice numerazione"
USE %NUM
INPUT CODTAB F_CODNUMFAT
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODNUMFAT CODTAB
FLAG "UPA"
WARNING "Numerazione assente"
KEY 1 2
STRING F_CODNUMFAT 4
BEGIN
PROMPT 2 8 "Numerazione fatture "
FIELD SKCODNUMFAT
HELP "Codice numerazione"
USE %NUM
INPUT CODTAB F_CODNUMFAT
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODNUMFAT CODTAB
FLAG "UPA"
WARNING "Numerazione assente"
KEY 1 2
END
STRING F_TIPODOCFAT 4
BEGIN
PROMPT 40 8 "Tipo fatture "
FIELD SKTIPODOCFAT
HELP "Codice tipo documento"
USE %TIP
INPUT CODTAB F_TIPODOCFAT
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_TIPODOCFAT CODTAB
FLAG "UP"
STRING F_TIPODOCFAT 4
BEGIN
PROMPT 40 8 "Tipo fatture "
FIELD SKTIPODOCFAT
HELP "Codice tipo documento"
USE %TIP
INPUT CODTAB F_TIPODOCFAT
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_TIPODOCFAT CODTAB
FLAG "UP"
END
STRING F_CODNUMNC 4
BEGIN
PROMPT 2 9 "Numerazione NC "
FIELD SKCODNUMNC
HELP "Codice numerazione"
USE %NUM
INPUT CODTAB F_CODNUMNC
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODNUMNC CODTAB
FLAG "UPA"
WARNING "Numerazione assente"
KEY 1 2
STRING F_CODNUMNC 4
BEGIN
PROMPT 2 9 "Numerazione NC "
FIELD SKCODNUMNC
HELP "Codice numerazione"
USE %NUM
INPUT CODTAB F_CODNUMNC
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODNUMNC CODTAB
FLAG "UPA"
WARNING "Numerazione assente"
KEY 1 2
END
STRING F_TIPODOCNC 4
BEGIN
PROMPT 40 9 "Tipo NC "
FIELD SKTIPODOCNC
HELP "Codice tipo documento"
USE %TIP
INPUT CODTAB F_TIPODOCNC
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_TIPODOCNC CODTAB
FLAG "UP"
STRING F_TIPODOCNC 4
BEGIN
PROMPT 40 9 "Tipo NC "
FIELD SKTIPODOCNC
HELP "Codice tipo documento"
USE %TIP
INPUT CODTAB F_TIPODOCNC
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_TIPODOCNC CODTAB
FLAG "UP"
END
STRING F_CODNUMTAM 4
BEGIN
PROMPT 2 10 "Numerazione TAM "
FIELD SKCODNUMTAM
HELP "Codice numerazione"
USE %NUM
INPUT CODTAB F_CODNUMTAM
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODNUMTAM CODTAB
FLAG "UPA"
WARNING "Numerazione assente"
KEY 1 2
STRING F_CODNUMTAM 4
BEGIN
PROMPT 2 10 "Numerazione TAM "
FIELD SKCODNUMTAM
HELP "Codice numerazione"
USE %NUM
INPUT CODTAB F_CODNUMTAM
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODNUMTAM CODTAB
FLAG "UPA"
WARNING "Numerazione assente"
KEY 1 2
END
STRING F_TIPODOCTAM 4
BEGIN
PROMPT 40 10 "Tipo TAM "
FIELD SKTIPODOCTAM
HELP "Codice tipo documento"
USE %TIP
INPUT CODTAB F_TIPODOCTAM
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_TIPODOCTAM CODTAB
FLAG "UP"
STRING F_TIPODOCTAM 4
BEGIN
PROMPT 40 10 "Tipo TAM "
FIELD SKTIPODOCTAM
HELP "Codice tipo documento"
USE %TIP
INPUT CODTAB F_TIPODOCTAM
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_TIPODOCTAM CODTAB
FLAG "UP"
END
STRING F_CODNUMORC 4
BEGIN
PROMPT 2 11 "Numerazione ORC "
FIELD SKCODNUMORC
HELP "Codice numerazione"
USE %NUM
INPUT CODTAB F_CODNUMORC
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODNUMORC CODTAB
FLAG "UPA"
WARNING "Numerazione assente"
KEY 1 2
STRING F_CODNUMORC 4
BEGIN
PROMPT 2 11 "Numerazione ORC "
FIELD SKCODNUMORC
HELP "Codice numerazione"
USE %NUM
INPUT CODTAB F_CODNUMORC
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODNUMORC CODTAB
FLAG "UPA"
WARNING "Numerazione assente"
KEY 1 2
END
STRING F_TIPODOCORC 4
BEGIN
PROMPT 40 11 "Tipo ORC "
FIELD SKTIPODOCORC
HELP "Codice tipo documento"
USE %TIP
INPUT CODTAB F_TIPODOCORC
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_TIPODOCORC CODTAB
FLAG "UP"
STRING F_TIPODOCORC 4
BEGIN
PROMPT 40 11 "Tipo ORC "
FIELD SKTIPODOCORC
HELP "Codice tipo documento"
USE %TIP
INPUT CODTAB F_TIPODOCORC
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_TIPODOCORC CODTAB
FLAG "UP"
END
STRING F_CODIVADEF 4
BEGIN
PROMPT 2 13 "Utilizza cod.IVA default "
USE %IVA
INPUT CODTAB F_CODIVADEF
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
DISPLAY "%@6" R0
DISPLAY "Tipo" S1
USE %IVA
INPUT CODTAB F_CODIVADEF
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
DISPLAY "%@6" R0
DISPLAY "Tipo" S1
OUTPUT F_CODIVADEF CODTAB
HELP "Codice IVA per righe con valore nullo"
FIELD SKCodIvaDef
@ -216,10 +216,10 @@ END
STRING F_CODUMSDEF 4
BEGIN
PROMPT 2 14 "Utilizza UMS default "
USE %UMS
INPUT CODTAB F_CODUMSDEF
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
USE %UMS
INPUT CODTAB F_CODUMSDEF
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODUMSDEF CODTAB
HELP "Codice UmS per righe con valore nullo"
FIELD SKCodUmsDef
@ -230,7 +230,7 @@ BOOLEAN F_OVERRIG
BEGIN
PROMPT 2 15 "Riga merce custom"
FIELD SKUseCustomRiga
MESSAGE FALSE DISABLE,F_NUMCUSTRIG
MESSAGE FALSE DISABLE,F_NUMCUSTRIG
MESSAGE TRUE ENABLE,F_NUMCUSTRIG
END

View File

@ -15,7 +15,6 @@
// Utility
///////////////////////////////////////////////////////////
const TString my_origin();
const TString their_origin();
const TString clifo_add_note(TLocalisamfile& cfv, TString& note);

View File

@ -1,14 +1,15 @@
[BSMENU_001]
Caption = "Bee Store"
Picture = <ve01>
Module = bs
Flags = "F"
Item_01 = "Configurazione", "bs0 -0", "F", 9015
Item_02 = "Sincronizzazione", "bs0 -1", "F", 9015
Item_02 = "SKNET Importer", "bs0 -2", "F", 9015
Item_03 = "Tabelle di conversione", [BSMENU_002]
[BSMENU_002]
[BSMENU_001]
Caption = "Bee Store"
Picture = <ve01>
Module = bs
Flags = "F"
Item_01 = "Configurazione", "bs0 -0", "F", 9015
Item_02 = "Sincronizzazione", "bs0 -1", "F", 9015
Item_02 = "newpage", "bs0 -1", "F", 9015
Item_02 = "SKNET Importer", "bs0 -2", "F", 9015
Item_03 = "Tabelle di conversione", [BSMENU_002]
[BSMENU_002]
Caption = "Tabelle di conversione"
Picture = <ve01>
Module = bs

View File

@ -1,7 +1,6 @@
#ifndef __DOC_H
#define __DOC_H
#define DOC_CODNUM "CODNUM"
#define DOC_ANNO "ANNO"
#define DOC_PROVV "PROVV"
@ -26,7 +25,7 @@
#define DOC_IBAN "IBAN"
#define DOC_CODABIP "CODABIP"
#define DOC_CODCABP "CODCABP"
#define DOC_PROGBNP "PROGBNP"
#define DOC_PROGBNP "PROGBNP"
#define DOC_CATVEN "CATVEN"
#define DOC_CODLIST "CODLIST"
#define DOC_CODCONT "CODCONT"
@ -75,7 +74,7 @@
#define DOC_G1 "G1"
#define DOC_DATAAGG "DATAAGG"
#define DOC_UTENTE "UTENTE"
#define DOC_COLL_GOLEM "COLL_GOLEM"
#define DOC_COLL_GOLEM "COLL_GOLEM"
#define DOC_DOCEVASO "DOCEVASO"
#define DOC_CONTROEURO "CONTROEURO"
#define DOC_CODCMS "CODCMS"
@ -86,13 +85,13 @@
#define DOC_NUMREGCA "NUMREGCA"
#define DOC_TIPOCFFATT "TIPOCFFATT"
#define DOC_CODCFFATT "CODCFFATT"
#define DOC_LIQDIFF "LIQDIFF"
#define DOC_IVAXCASSA "IVAXCASSA"
#define DOC_LIQDIFF "LIQDIFF"
#define DOC_IVAXCASSA "IVAXCASSA"
#define DOC_DATACOMP "DATACOMP"
#define DOC_DATAFCOMP "DATAFCOMP"
#define DOC_DATASCIMP "DATASCIMP"
#define DOC_CUP "CUP"
#define DOC_CIG "CIG"
#define DOC_CUP "CUP"
#define DOC_CIG "CIG"
#define DOC_CONTSEP "CONTSEP"
#define DOC_NOLEGGIO "NOLEGGIO"
#define DOC_MODPAG "MODPAG"
@ -105,13 +104,13 @@
#define DOC_NOINVIOSDI "NOINVIOSDI"
// Virtuali
#define DOC_PLAFOND "PLAFOND"
#define DOC_FATID "FATID"
#define DOC_BOLLI "BOLLI"
#define DOC_PLAFOND "PLAFOND"
#define DOC_FATID "FATID"
#define DOC_BOLLI "BOLLI"
// modulo pe
#define DOC_SPESEUPD "SPESEUPD"
#define DOC_USEK "USEK"
#define DOC_K "K"
#define DOC_SPESEUPD "SPESEUPD"
#define DOC_USEK "USEK"
#define DOC_K "K"
#endif

View File

@ -1559,7 +1559,7 @@ void TRelation_application::main_loop()
{
for (TEdit_field* e = (TEdit_field *) _mask->get_key_field(1, TRUE); e; e = (TEdit_field *) _mask->get_key_field(1, FALSE))
{
if (e->is_kind_of(CLASS_EDIT_FIELD) && e->shown() && e->browse() != NULL) // Ignora campi invisibili o senza check
if (e->is_kind_of(CLASS_EDIT_FIELD) && e->shown() && e->browse() != NULL) // Ignora campi invisibili o senza check
{
TCursor* b = e->browse()->cursor();
@ -1611,28 +1611,28 @@ void TRelation_application::main_loop()
}
}
TCursor* cur = c ;
TCursor* cur = c ;
if (c == NULL)
cur = new TCursor(get_relation());
cur = new TCursor(get_relation());
file().reread();
file().reread();
cur->curr() = file().curr();
cur->read();
--(*cur);
while (cur->pos() > 0 && !can_I_read(cur->relation()))
while (cur->pos() > 0 && !can_I_read(cur->relation()))
--(*cur);
file().curr() = cur->curr();
if (can_I_read(cur->relation()))
err = get_relation()->read(_isequal, _testandlock);
err = get_relation()->read(_isequal, _testandlock);
if (c == NULL)
delete cur;
}
break;
case K_END:
case K_END:
err = file().readat(_last, _testandlock);
break;
default:
default:
break;
}
if (err == NOERR || err == _islocked)
@ -1649,7 +1649,7 @@ void TRelation_application::main_loop()
} while (k != K_QUIT);
if (_mask->is_open())
_mask->close_modal();
_mask->close_modal();
_mask->set_mode(NO_MODE);

View File

@ -1,342 +1,342 @@
#include <automask.h>
#include <diction.h>
#include <reprint.h>
#include <reputils.h>
#include <utility.h>
#include "velib04.h"
#include "velib04e.h"
#include <doc.h>
class TConsuntivazione_mask : public TAutomask
{
protected:
void reload_sheet();
void load_sheet();
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
TConsuntivazione_mask() : TAutomask("velib04e") {}
virtual ~TConsuntivazione_mask() { }
};
#include <automask.h>
#include <diction.h>
#include <reprint.h>
#include <reputils.h>
#include <utility.h>
#include "velib04.h"
#include "velib04e.h"
#include <doc.h>
class TConsuntivazione_mask : public TAutomask
{
protected:
void reload_sheet();
void load_sheet();
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
TConsuntivazione_mask() : TAutomask("velib04e") {}
virtual ~TConsuntivazione_mask() { }
};
TConsuntivazione_mask& msk()
{
static TConsuntivazione_mask* msk = NULL;
if (msk == NULL)
msk = new TConsuntivazione_mask();
return *msk;
}
static bool scan_rilprod(const TRelation& rel, void* pJolly)
{
const TRectype& rec = rel.curr();
// Prima di fare qualsiasi cosa controllo che la riga vada messa
// Abilito le righe aperte
if(!msk().get_bool(B_RIGHE_APERTE) && !rec.get_bool("CHIUSO"))
return true;
// Abilito le righe chiuse con QTA <= 0
if(!msk().get_bool(B_RIGHE_CHIU_QTA) && rec.get_bool("CHIUSO") && rec.get_real(RDOC_QTA) <= ZERO)
return true;
TSheet_field& sheet = *(TSheet_field*)pJolly;
TToken_string& row = sheet.row(-1);
TLocalisamfile righe(LF_RRILPROD);
const TString codart(rec.get(RDOC_CODART));
const int prog = rec.get_int("PROG");
const TDate data(rec.get("DATA"));
righe.put("CODART", codart);
righe.put("DATA", data);
righe.put("PROG", prog);
righe.put("NRIGA", 999);
int err = righe.read(_isequal, _testandlock);
if (err == _iskeynotfound)
righe.prev();
row.add(codart, sheet.cid2index(S_CODART));
row.add(format("%d", prog), sheet.cid2index(S_PROG));
row.add(data.string(), sheet.cid2index(S_DATA));
row.add(rec.get(RDOC_IMPIANTO), sheet.cid2index(S_IMPIANTO));
row.add(rec.get(RDOC_LINEA), sheet.cid2index(S_LINEA));
if (codart == righe.get("CODART"))
row.add(righe.get("DATAFINE"), sheet.cid2index(S_DATAPROD));
row.add(rec.get(RDOC_QTA), sheet.cid2index(S_QTA));
row.add(rec.get("CHIUSO"), sheet.cid2index(S_CHIUSO));
row.add(rec.get(RDOC_PROVV), sheet.cid2index(S_PROVV));
row.add(rec.get(RDOC_ANNO), sheet.cid2index(S_ANNO));
row.add(rec.get(RDOC_CODNUM), sheet.cid2index(S_CODNUM));
row.add(rec.get(RDOC_NDOC), sheet.cid2index(S_NDOC));
row.add(rec.get(RDOC_NRIGA), sheet.cid2index(S_NRIGA));
return true;
}
void TConsuntivazione_mask::reload_sheet()
{
load_sheet();
TSheet_field& s = sfield(F_SHEET);
FOR_EACH_SHEET_ROW(s, n, row)
{
const real r(row->get(s.cid2index(S_QTA)));
if (r <= ZERO)
s.disable_row(n);
}
s.force_update();
}
void TConsuntivazione_mask::load_sheet()
{
TRelation rel(LF_RILPROD);
TCursor cur(&rel, "CODNUMP==\"\"");
TSheet_field& sheet = sfield(F_SHEET);
sheet.destroy();
cur.scan(scan_rilprod, &sheet);
sheet.force_update();
}
bool TConsuntivazione_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
case DLG_RECALC:
if(e == fe_button)
reload_sheet();
case F_SHEET:
if (e == fe_init)
{
reload_sheet();
}
break;
case DLG_TUTTE:
if (e == fe_button)
{
TSheet_field& s = sfield(F_SHEET);
FOR_EACH_SHEET_ROW(s, n, row)
{
const int pos = s.cid2index(S_SELECTED);
const TString16 v(row->get(pos));
if (s.row_enabled(n))
{
if (v.blank())
row->add("X", pos);
else
row->add(" ", pos);
}
}
s.force_update();
}
break;
default:
break;
}
return true;
}
bool TConsuntivazione_produzione::ref2doc(char & provv, int & anno, TString8 & codnum, long & ndoc, int & nriga, const TString & codart)
{
const TString8 ordprod(tipo_iniziale(0));
bool ok = true;
if (codnum != ordprod)
{
char p = provv;
int a = anno;
TString8 c(codnum);
long nd = ndoc;
int nr = nriga;
TLocalisamfile f(LF_RIGHEDOC);
TRectype & rec = f.curr();
rec.put(RDOC_DAPROVV, p);
rec.put(RDOC_DAANNO, a);
rec.put(RDOC_DACODNUM, c);
rec.put(RDOC_DANDOC, nd);
rec.put(RDOC_DAIDRIGA, nr);
TRectype cmp(rec);
f.setkey(4);
ok = false;
for (int err = f.read(_isequal); !ok && rec == cmp && err == NOERR; err = f.next())
{
if (rec.get(RDOC_CODNUM) == ordprod)
if(rec.get(RDOC_CODARTMAG) == codart)
{
provv = rec.get_char(RDOC_PROVV);
anno = rec.get_int(RDOC_ANNO);
codnum = rec.get(RDOC_CODNUM);
ndoc = rec.get_long(RDOC_NDOC);
nriga = rec.get_int(RDOC_NRIGA);
ok = true;
}
}
}
return ok;
}
bool TConsuntivazione_produzione::elabora(TLista_documenti& doc_in, TLista_documenti& doc_out,
const TDate& data_elab, bool interattivo)
{
//TConsuntivazione_mask msk;
TLog_report log("Consuntivazione produzione");
bool done = false;
if (msk().run() == K_ENTER)
{
TSheet_field& sheet = msk().sfield(F_SHEET);
TLocalisamfile rilevazioni(LF_RILPROD);
TRectype& ril = rilevazioni.curr();
const TString8 codnum = codice_numerazione_finale();
if (codnum.blank())
return error_box("Manca il codice numerazione finale per l'elaborazione %s", (const char *) codice());
const TString8 tipodoc = tipo_finale();
if (tipodoc.blank())
return error_box("Manca il tipo documento finale per l'elaborazione %s", (const char *) codice());
pre_process_input(doc_in);
if (doc_out.items() == 0)
{
TDocumento d('D', data_elab.year(), codnum, 0L);
d.set_tipo(tipodoc);
d.stato(stato_finale()[0]);
d.put(DOC_DATADOC, data_elab);
d.write();
TDocumento * d1 = new TDocumento(d.head());
doc_out.add(d1);
}
TDocumento& outdoc = doc_out[0];
TDocumento ordine;
FOR_EACH_SHEET_ROW(sheet, i, row) if (*row->get(0)=='X') // Per ogni riga selezionata
{
const TString codart = row->get(sheet.cid2index(S_CODART));
const TDate data = row->get(sheet.cid2index(S_DATA));
const int prog = row->get_int(sheet.cid2index(S_PROG));
const real qta = row->get(sheet.cid2index(S_QTA));
bool chiuso = row->get(sheet.cid2index(S_CHIUSO))[0] > ' ';
char provv = row->get(sheet.cid2index(S_PROVV))[0];
int anno = row->get_int(sheet.cid2index(S_ANNO));
TString8 codnum = row->get(sheet.cid2index(S_CODNUM));
long ndoc = row->get_long(sheet.cid2index(S_NDOC));
int nriga = row->get_int(sheet.cid2index(S_NRIGA));
if (ref2doc(provv, anno, codnum, ndoc, nriga, codart))
{
int err = ordine.read(provv, anno, codnum, ndoc, _isequal, _testandlock);
if (err == NOERR)
{
if (nriga > 0 && nriga <= ordine.rows())
{
TRiga_documento& riga_ordine = ordine[nriga];
const TString& qta_fld = riga_ordine.field_qta();
const TString& qte_fld = riga_ordine.field_qtaevasa();
const real qta_evasa = riga_ordine.qtaevasa() + qta;
riga_ordine.put(qte_fld, qta_evasa);
if (chiuso || riga_ordine.qtaresidua().is_zero())
{
riga_ordine.put(RDOC_RIGAEVASA, 'X');
chiuso = true;
}
const TString4 tiporiga = riga_ordine.get(RDOC_TIPORIGA);
TRiga_documento& outrec = outdoc.new_row(tiporiga);
TDocumento::copy_data(outrec, riga_ordine);
outrec.put(qta_fld, qta);
if (qta_fld != RDOC_QTA)
{
const real q = riga_ordine.get_real(RDOC_QTA);
if (q.is_zero())
outrec.put(RDOC_QTA, UNO); // Pezza temporanea
}
if (kill_descrizione_estesa()) // Cancello eventualmente la descrizione estesa
{
outrec.zero(RDOC_DESCLUNGA);
outrec.zero(RDOC_DESCEST);
}
outrec.dirty_fields(); // Forza ricalcolo peso etc.
outrec.put(RDOC_DATACONS, data); // Setta la data di consegna con la data di produzione
outrec.zero(qte_fld); // Azzera quantita' evasa erroneamente copiata dall'ordine
outrec.zero(RDOC_RIGAEVASA); // Azzera flag di evasa erroneamente copiata dall'ordine
outrec.set_original_rdoc_key(riga_ordine);
}
else
{
const char* msg = TR("Impossibile aggiornare il documento");
log.log(1, format("%s %d %s %ld", msg, anno, (const char*)codnum, ndoc));
}
if (ordine.is_evaso())
ordine.stato(stato_finale_doc_iniziale()[0]);
err = ordine.rewrite(); // Unlocca
if (err != NOERR)
{
const char* msg = TR("Impossibile aggiornare il documento");
log.log(1, format("%s %d %s %ld", msg, anno, (const char*)codnum, ndoc));
}
done = true;
ril.put("CODART", codart);
ril.put("DATA", data);
ril.put("PROG", prog);
err = rilevazioni.read(_isequal, _testandlock);
if (err == NOERR)
{
if (chiuso)
ril.put("CHIUSO", chiuso);
ril.put("PROVVP", outdoc.get(DOC_PROVV));
ril.put("ANNOP", outdoc.get(DOC_ANNO));
ril.put("CODNUMP", outdoc.get(DOC_CODNUM));
ril.put("NDOCP", outdoc.get(DOC_NDOC));
ril.put("NRIGAP", outdoc.rows());
err = rilevazioni.rewrite();
}
if (err != NOERR)
{
const char* msg = TR("Impossibile aggiornare la riga di rilevazione");
log.log(1, format("%s %s %s %d", msg, (const char*)codart, (const char*)data.string(), prog));
break;
}
}
else
{
const char* msg = TR("Impossibile leggere l'ordine di produzione");
log.log(1, format("%s %d %s %ld", msg, anno, (const char*)codnum, ndoc));
}
}
else
{
const char* msg = TR("Impossibile trovare l'ordine di produzione relativo all'ordine cliente");
log.log(1, format("%s %d %s %ld", msg, anno, (const char*)codnum, ndoc));
ril.put("CODART", codart);
ril.put("DATA", data);
ril.put("PROG", prog);
if (rilevazioni.read(_isequal, _testandlock) == NOERR)
{
ril.put("CHIUSO", chiuso);
ril.put("CODNUMP", outdoc.get(DOC_CODNUM));
rilevazioni.rewrite();
}
}
}
}
TReport_book book;
book.add(log);
book.preview();
post_process_input(doc_in);
post_process(doc_out, doc_in);
return done;
}
static bool scan_rilprod(const TRelation& rel, void* pJolly)
{
const TRectype& rec = rel.curr();
// Prima di fare qualsiasi cosa controllo che la riga vada messa
// Abilito le righe aperte
if(!msk().get_bool(B_RIGHE_APERTE) && !rec.get_bool("CHIUSO"))
return true;
// Abilito le righe chiuse con QTA <= 0
if(!msk().get_bool(B_RIGHE_CHIU_QTA) && rec.get_bool("CHIUSO") && rec.get_real(RDOC_QTA) <= ZERO)
return true;
TSheet_field& sheet = *(TSheet_field*)pJolly;
TToken_string& row = sheet.row(-1);
TLocalisamfile righe(LF_RRILPROD);
const TString codart(rec.get(RDOC_CODART));
const int prog = rec.get_int("PROG");
const TDate data(rec.get("DATA"));
righe.put("CODART", codart);
righe.put("DATA", data);
righe.put("PROG", prog);
righe.put("NRIGA", 999);
int err = righe.read(_isequal, _testandlock);
if (err == _iskeynotfound)
righe.prev();
row.add(codart, sheet.cid2index(S_CODART));
row.add(format("%d", prog), sheet.cid2index(S_PROG));
row.add(data.string(), sheet.cid2index(S_DATA));
row.add(rec.get(RDOC_IMPIANTO), sheet.cid2index(S_IMPIANTO));
row.add(rec.get(RDOC_LINEA), sheet.cid2index(S_LINEA));
if (codart == righe.get("CODART"))
row.add(righe.get("DATAFINE"), sheet.cid2index(S_DATAPROD));
row.add(rec.get(RDOC_QTA), sheet.cid2index(S_QTA));
row.add(rec.get("CHIUSO"), sheet.cid2index(S_CHIUSO));
row.add(rec.get(RDOC_PROVV), sheet.cid2index(S_PROVV));
row.add(rec.get(RDOC_ANNO), sheet.cid2index(S_ANNO));
row.add(rec.get(RDOC_CODNUM), sheet.cid2index(S_CODNUM));
row.add(rec.get(RDOC_NDOC), sheet.cid2index(S_NDOC));
row.add(rec.get(RDOC_NRIGA), sheet.cid2index(S_NRIGA));
return true;
}
void TConsuntivazione_mask::reload_sheet()
{
load_sheet();
TSheet_field& s = sfield(F_SHEET);
FOR_EACH_SHEET_ROW(s, n, row)
{
const real r(row->get(s.cid2index(S_QTA)));
if (r <= ZERO)
s.disable_row(n);
}
s.force_update();
}
void TConsuntivazione_mask::load_sheet()
{
TRelation rel(LF_RILPROD);
TCursor cur(&rel, "CODNUMP==\"\"");
TSheet_field& sheet = sfield(F_SHEET);
sheet.destroy();
cur.scan(scan_rilprod, &sheet);
sheet.force_update();
}
bool TConsuntivazione_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
case DLG_RECALC:
if(e == fe_button)
reload_sheet();
case F_SHEET:
if (e == fe_init)
{
reload_sheet();
}
break;
case DLG_TUTTE:
if (e == fe_button)
{
TSheet_field& s = sfield(F_SHEET);
FOR_EACH_SHEET_ROW(s, n, row)
{
const int pos = s.cid2index(S_SELECTED);
const TString16 v(row->get(pos));
if (s.row_enabled(n))
{
if (v.blank())
row->add("X", pos);
else
row->add(" ", pos);
}
}
s.force_update();
}
break;
default:
break;
}
return true;
}
bool TConsuntivazione_produzione::ref2doc(char & provv, int & anno, TString8 & codnum, long & ndoc, int & nriga, const TString & codart)
{
const TString8 ordprod(tipo_iniziale(0));
bool ok = true;
if (codnum != ordprod)
{
char p = provv;
int a = anno;
TString8 c(codnum);
long nd = ndoc;
int nr = nriga;
TLocalisamfile f(LF_RIGHEDOC);
TRectype & rec = f.curr();
rec.put(RDOC_DAPROVV, p);
rec.put(RDOC_DAANNO, a);
rec.put(RDOC_DACODNUM, c);
rec.put(RDOC_DANDOC, nd);
rec.put(RDOC_DAIDRIGA, nr);
TRectype cmp(rec);
f.setkey(4);
ok = false;
for (int err = f.read(_isequal); !ok && rec == cmp && err == NOERR; err = f.next())
{
if (rec.get(RDOC_CODNUM) == ordprod)
if(rec.get(RDOC_CODARTMAG) == codart)
{
provv = rec.get_char(RDOC_PROVV);
anno = rec.get_int(RDOC_ANNO);
codnum = rec.get(RDOC_CODNUM);
ndoc = rec.get_long(RDOC_NDOC);
nriga = rec.get_int(RDOC_NRIGA);
ok = true;
}
}
}
return ok;
}
bool TConsuntivazione_produzione::elabora(TLista_documenti& doc_in, TLista_documenti& doc_out,
const TDate& data_elab, bool interattivo)
{
//TConsuntivazione_mask msk;
TLog_report log("Consuntivazione produzione");
bool done = false;
if (msk().run() == K_ENTER)
{
TSheet_field& sheet = msk().sfield(F_SHEET);
TLocalisamfile rilevazioni(LF_RILPROD);
TRectype& ril = rilevazioni.curr();
const TString8 codnum = codice_numerazione_finale();
if (codnum.blank())
return error_box("Manca il codice numerazione finale per l'elaborazione %s", (const char *) codice());
const TString8 tipodoc = tipo_finale();
if (tipodoc.blank())
return error_box("Manca il tipo documento finale per l'elaborazione %s", (const char *) codice());
pre_process_input(doc_in);
if (doc_out.items() == 0)
{
TDocumento d('D', data_elab.year(), codnum, 0L);
d.set_tipo(tipodoc);
d.stato(stato_finale()[0]);
d.put(DOC_DATADOC, data_elab);
d.write();
TDocumento * d1 = new TDocumento(d.head());
doc_out.add(d1);
}
TDocumento& outdoc = doc_out[0];
TDocumento ordine;
FOR_EACH_SHEET_ROW(sheet, i, row) if (*row->get(0)=='X') // Per ogni riga selezionata
{
const TString codart = row->get(sheet.cid2index(S_CODART));
const TDate data = row->get(sheet.cid2index(S_DATA));
const int prog = row->get_int(sheet.cid2index(S_PROG));
const real qta = row->get(sheet.cid2index(S_QTA));
bool chiuso = row->get(sheet.cid2index(S_CHIUSO))[0] > ' ';
char provv = row->get(sheet.cid2index(S_PROVV))[0];
int anno = row->get_int(sheet.cid2index(S_ANNO));
TString8 codnum = row->get(sheet.cid2index(S_CODNUM));
long ndoc = row->get_long(sheet.cid2index(S_NDOC));
int nriga = row->get_int(sheet.cid2index(S_NRIGA));
if (ref2doc(provv, anno, codnum, ndoc, nriga, codart))
{
int err = ordine.read(provv, anno, codnum, ndoc, _isequal, _testandlock);
if (err == NOERR)
{
if (nriga > 0 && nriga <= ordine.rows())
{
TRiga_documento& riga_ordine = ordine[nriga];
const TString& qta_fld = riga_ordine.field_qta();
const TString& qte_fld = riga_ordine.field_qtaevasa();
const real qta_evasa = riga_ordine.qtaevasa() + qta;
riga_ordine.put(qte_fld, qta_evasa);
if (chiuso || riga_ordine.qtaresidua().is_zero())
{
riga_ordine.put(RDOC_RIGAEVASA, 'X');
chiuso = true;
}
const TString4 tiporiga = riga_ordine.get(RDOC_TIPORIGA);
TRiga_documento& outrec = outdoc.new_row(tiporiga);
TDocumento::copy_data(outrec, riga_ordine);
outrec.put(qta_fld, qta);
if (qta_fld != RDOC_QTA)
{
const real q = riga_ordine.get_real(RDOC_QTA);
if (q.is_zero())
outrec.put(RDOC_QTA, UNO); // Pezza temporanea
}
if (kill_descrizione_estesa()) // Cancello eventualmente la descrizione estesa
{
outrec.zero(RDOC_DESCLUNGA);
outrec.zero(RDOC_DESCEST);
}
outrec.dirty_fields(); // Forza ricalcolo peso etc.
outrec.put(RDOC_DATACONS, data); // Setta la data di consegna con la data di produzione
outrec.zero(qte_fld); // Azzera quantita' evasa erroneamente copiata dall'ordine
outrec.zero(RDOC_RIGAEVASA); // Azzera flag di evasa erroneamente copiata dall'ordine
outrec.set_original_rdoc_key(riga_ordine);
}
else
{
const char* msg = TR("Impossibile aggiornare il documento");
log.log(1, format("%s %d %s %ld", msg, anno, (const char*)codnum, ndoc));
}
if (ordine.is_evaso())
ordine.stato(stato_finale_doc_iniziale()[0]);
err = ordine.rewrite(); // Unlocca
if (err != NOERR)
{
const char* msg = TR("Impossibile aggiornare il documento");
log.log(1, format("%s %d %s %ld", msg, anno, (const char*)codnum, ndoc));
}
done = true;
ril.put("CODART", codart);
ril.put("DATA", data);
ril.put("PROG", prog);
err = rilevazioni.read(_isequal, _testandlock);
if (err == NOERR)
{
if (chiuso)
ril.put("CHIUSO", chiuso);
ril.put("PROVVP", outdoc.get(DOC_PROVV));
ril.put("ANNOP", outdoc.get(DOC_ANNO));
ril.put("CODNUMP", outdoc.get(DOC_CODNUM));
ril.put("NDOCP", outdoc.get(DOC_NDOC));
ril.put("NRIGAP", outdoc.rows());
err = rilevazioni.rewrite();
}
if (err != NOERR)
{
const char* msg = TR("Impossibile aggiornare la riga di rilevazione");
log.log(1, format("%s %s %s %d", msg, (const char*)codart, (const char*)data.string(), prog));
break;
}
}
else
{
const char* msg = TR("Impossibile leggere l'ordine di produzione");
log.log(1, format("%s %d %s %ld", msg, anno, (const char*)codnum, ndoc));
}
}
else
{
const char* msg = TR("Impossibile trovare l'ordine di produzione relativo all'ordine cliente");
log.log(1, format("%s %d %s %ld", msg, anno, (const char*)codnum, ndoc));
ril.put("CODART", codart);
ril.put("DATA", data);
ril.put("PROG", prog);
if (rilevazioni.read(_isequal, _testandlock) == NOERR)
{
ril.put("CHIUSO", chiuso);
ril.put("CODNUMP", outdoc.get(DOC_CODNUM));
rilevazioni.rewrite();
}
}
}
}
TReport_book book;
book.add(log);
book.preview();
post_process_input(doc_in);
post_process(doc_out, doc_in);
return done;
}