//--------------------------------------------------------------------------- #include #include #pragma hdrstop #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { if ( !ParamStr(1).IsEmpty() ) TbD->TableName = ParamStr(1) + "Datos\\Tb_Ref.db"; TbD->IndexName = "FamIdx"; TbD->Active = true; GenerarIndice( "tprodl.htm" ); Label2->Font->Color = clMaroon; GenerarEnlaces(); Timer1->Enabled = true; } //--------------------------------------------------------------------------- void __fastcall TForm1::GenerarIndice( AnsiString FicheroSalida ) { int Nivel = 0, NivelPrimario; int iFileHandle; AnsiString Header, Body, Footer, Familia, Hijo, CSS; Header = " \ \ Arbol Indice\ \ \
\ "; Footer = "
"; CSS = "class=z onmouseover=\"this.className='a';return true\" onmouseout=\"this.className='z';\" "; iFileHandle = FileCreate( FicheroSalida ); FileWrite(iFileHandle, Header.c_str(), Header.Length() ); ProgressBar1->Position = 0; ProgressBar1->Max = TbD->RecordCount; TbD->First(); while( !TbD->Eof ) { if ( TbD->FieldByName("EsNodo")->AsInteger == -1 ) { NivelPrimario = TbD->FieldByName("Familia")->AsInteger; if ( (NivelPrimario & 0xFF000000) ) Nivel = 1; if ( (NivelPrimario & 0x00FF0000) ) Nivel = 2; if ( (NivelPrimario & 0x0000FF00) ) Nivel = 3; if ( (NivelPrimario & 0x000000FF) ) Nivel = 4; #define Nivel_1 24 #define Nivel_2 16 #define Nivel_3 8 #define NivelRuptura Nivel_2 Familia = AnsiString( NivelPrimario>>NivelRuptura ); Hijo = TbD->FieldByName("Familia")->AsString; switch( Nivel ) { case 1: Body ="
"+TbD->FieldByName("Nombre del Producto")->AsString+ ""; break; case 2: Body =""+TbD->FieldByName("Nombre del Producto")->AsString+ ""; break; case 3: Body =""+TbD->FieldByName("Nombre del Producto")->AsString+ ""; break; case 4: Body =""+TbD->FieldByName("Nombre del Producto")->AsString+ ""; break; // } FileWrite(iFileHandle, Body.c_str(), Body.Length() ); } ProgressBar1->Position++; TbD->Next(); } FileWrite(iFileHandle, Footer.c_str(), Footer.Length() ); FileClose(iFileHandle); } //--------------------------------------------------------------------------- void __fastcall TForm1::GenerarEnlaces() { int Nivel = 0, NivelPrimario; int iFileHandle; AnsiString Header, Body, Footer, Familia, Hijo, ImageName; Header = " \ \ Arbol Indice \ "; Footer = "

*Estos precios no incluyen IVA
Última actualización de esta página "+DateToStr(Date())+" - "+TimeToStr(Time())+"

"; if (!DirectoryExists( "imgprod" )) CreateDir("imgprod"); iFileHandle = FileCreate( "errores.html" ); FileWrite(iFileHandle, Header.c_str(), Header.Length() ); ProgressBar1->Position = 0; ProgressBar1->Max = TbD->RecordCount; TbD->First(); while( !TbD->Eof ) { if ( TbD->FieldByName("EsNodo")->AsInteger == -1 ) { NivelPrimario = TbD->FieldByName("Familia")->AsInteger; if ( (NivelPrimario & 0xFF000000) ) Nivel = 1; if ( (NivelPrimario & 0x00FF0000) ) Nivel = 2; if ( (NivelPrimario & 0x0000FF00) ) Nivel = 3; if ( (NivelPrimario & 0x000000FF) ) Nivel = 4; Familia = AnsiString( NivelPrimario>>NivelRuptura ); Hijo = TbD->FieldByName("Familia")->AsString; if ( Nivel==1 || (NivelRuptura==16 && Nivel==2) || (NivelRuptura==8 && Nivel==3) ) { FileWrite(iFileHandle, Footer.c_str(), Footer.Length() ); FileClose(iFileHandle); iFileHandle = FileCreate( Familia+".htm" ); FileWrite(iFileHandle, Header.c_str(), Header.Length() ); } switch( Nivel ) { case 1: case 2: Body = "

"+ TbD->FieldByName("Nombre del Producto")->AsString+"



\ \ "; break; case 3: Body = ""; break; case 4: Body = ""; break; } } else { Body = ""; //COPIAR IMAGEN AL DIRECTORIO LOCAL } else { Body = Body + " "; } Body = Body + ""; } FileWrite(iFileHandle, Body.c_str(), Body.Length() ); ProgressBar1->Position++; TbD->Next(); } FileWrite(iFileHandle, Footer.c_str(), Footer.Length() ); FileClose(iFileHandle); } //--------------------------------------------------------------------------- void __fastcall TForm1::Timer1Timer(TObject *Sender) { if ( TbD->Active ) TbD->Active = false; Close(); } //---------------------------------------------------------------------------
FotoArticuloCod.P.V.P 
 "+TbD->FieldByName("Nombre del Producto")->AsString+ "     
 "+TbD->FieldByName("Nombre del Producto")->AsString+ "     
"; if ( ! TbD->FieldByName( "PathImagen" )->AsString.IsEmpty() && FileExists( ParamStr(1) + TbD->FieldByName( "PathImagen" )->AsString) ) { ImageName = ExtractFileName(TbD->FieldByName( "PathImagen" )->AsString); CopyFile( AnsiString(ParamStr(1) + TbD->FieldByName( "PathImagen" )->AsString).c_str(), AnsiString("imgprod\\" + ImageName ).c_str(), True ); Body = Body + ""+TbD->FieldByName("Nombre del Producto")->AsString+" " + FormatCurr("###,###,###.#0", TbD->FieldByName("Precio Venta 1")->AsCurrency )+"" + FormatCurr("###,###,###.#0", TbD->FieldByName("Precio Venta 1")->AsCurrency / 166.386 )+" FieldByName("ForcedIndex")->AsString+"','"+TbD->FieldByName("Nombre del Producto")->AsString+"','"+TbD->FieldByName("Precio Venta 1")->AsString+"');\">