00001 /**************************************************************************** 00002 ** ui.h extension file, included from the uic-generated form implementation. 00003 ** 00004 ** If you wish to add, delete or rename functions or slots use 00005 ** Qt Designer which will update this file, preserving your code. Create an 00006 ** init() function in place of a constructor, and a destroy() function in 00007 ** place of a destructor. 00008 *****************************************************************************/ 00009 00010 void QlabPressTitle::init() 00011 { 00012 prods = new QSqlCursor( "Inv_products", TRUE ) ; 00013 parts = new QSqlCursor( "Inv_parts", TRUE ) ; 00014 cats = new QSqlCursor( "System_categories", TRUE ) ; 00015 prodid = 0 ; 00016 partsTable->setLeftMargin( 0 ) ; 00017 partsTable->setColumnWidth( 0, 100 ); 00018 partsTable->setColumnWidth( 1, 70 ) ; 00019 partsTable->setColumnWidth( 2, 70 ) ; 00020 partsTable->refresh( QDataTable::RefreshAll ) ; 00021 } 00022 00023 void QlabPressTitle::setMode( int mode ) 00024 { 00025 md = mode ; 00026 } 00027 00028 00029 void QlabPressTitle::setProdValues() 00030 { 00031 QString wid = QObject::sender()->name() ; 00032 qDebug( wid ) ; 00033 if ( wid == "prefix" ) { 00034 00035 } else if ( wid == "pCode" ) { 00036 00037 } else if ( wid == "prod_name" ) { 00038 00039 } else if ( wid == "frequency" ) { 00040 00041 } else if ( wid == "vendor_id" ) { 00042 } else if ( wid == "tax_id" ) { 00043 } else if ( wid == "base_buy_price" ) { 00044 } else if ( wid == "base_sell_price" ) { 00045 } else if ( wid == "base_retail" ) { 00046 } else if ( wid == "quick_rate" ) { 00047 } 00048 00049 } 00050 00051 00052 void QlabPressTitle::setProductId( int pid ) 00053 { 00054 prodid = pid ; 00055 } 00056 00057 00058 void QlabPressTitle::getCategoryPath() 00059 { 00060 QlabCategorySelector * dialog = new QlabCategorySelector( this, "CategorySelector", TRUE ) ; 00061 dialog->setApplicationName( "inv" ) ; 00062 if ( dialog->exec() == QDialog::Accepted ) { 00063 cat_path->setText( categoryPath( dialog->getCategoryId() ) ) ; 00064 } 00065 delete dialog ; 00066 } 00067 00068 00069 QString QlabPressTitle::categoryPath( int catId ) 00070 { 00071 int parent = 0 ; 00072 QString path = "" ; 00073 cats->setFilter( QString( "recid='%1'" ).arg( catId ) ) ; 00074 cats->select() ; 00075 if ( cats->next() ) { 00076 path = cats->value( "cat_name" ).toString() ; 00077 parent = cats->value( "cat_parent").toInt() ; 00078 while ( parent != 0 ) { 00079 cats->setFilter( QString( "recid='%1'" ).arg( parent ) ) ; 00080 cats->select() ; 00081 if ( cats->next() ) { 00082 path.prepend( QString( "%1 / " ).arg( cats->value( "cat_name" ).toString() ) ) ; 00083 parent = cats->value( "cat_parent").toInt() ; 00084 } 00085 } 00086 path.prepend( QString( "%1 = " ).arg( catId ) ) ; 00087 } 00088 return path ; 00089 }