void Multipart_CacheStorage::ConstructL(Cache_Storage * initial_storage, OpStringS8 &content_encoding) { StreamCache_Storage::ConstructL(initial_storage, content_encoding); desc = StreamCache_Storage::GetDescriptor(NULL, TRUE, FALSE, NULL); if(GetContentEncoding().HasContent()) { OpStackAutoPtr<URL_DataDescriptor> desc1(OP_NEW_L(URL_DataDescriptor, (url, NULL))); LEAVE_IF_ERROR(desc1->Init(TRUE)); #ifdef _HTTP_COMPRESS desc1->SetupContentDecodingL(GetContentEncoding().CStr()); #endif if(desc1->GetFirstDecoder() != NULL) { desc1->SetSubDescriptor(desc); desc = desc1.release(); AddDescriptor(desc); } // Auto cleanup } if(desc == NULL) LEAVE(OpStatus::ERR_NULL_POINTER); }
Cambio::Cambio ( BtCompany *emp, QWidget *parent ) : BlWidget ( emp, parent ) { setupUi ( this ); m_value = 0; base basesimp; base basesimpreqeq; BlDbRecord *linea; BtTicket *tick = emp->ticketActual(); /// Disparamos los plugins. int res = g_plugins->run ( "Cambio_ivainc_pre", this ); if ( res != 0 ) { return; } // end if /// Impresion de los contenidos. QString l; BlFixed irpf ( "0" ); BlDbRecordSet *cur = emp->loadQuery ( "SELECT * FROM configuracion WHERE nombre = 'IRPF'" ); if ( cur ) { if ( !cur->eof() ) { irpf = BlFixed ( cur->value( "valor" ) ); } // end if delete cur; } // end if BlFixed descuentolinea ( "0.00" ); for ( int i = 0; i < tick->listaLineas() ->size(); ++i ) { linea = tick->listaLineas() ->at ( i ); BlFixed cant ( linea->dbValue ( "cantlalbaran" ) ); cant.setPrecision(emp->decimalesCantidad()); BlFixed pvpund ( linea->dbValue ( "pvpivainclalbaran" ) ); pvpund.setPrecision(emp->decimalesCantidad()); BlFixed desc1 ( linea->dbValue ( "descuentolalbaran" ) ); BlFixed cantpvp = cant * pvpund; cantpvp.setPrecision(emp->decimalesCantidad()); BlFixed base = cantpvp - cantpvp * desc1 / 100; descuentolinea = descuentolinea + ( cantpvp * desc1 / 100 ); basesimp[linea->dbValue ( "ivalalbaran" ) ] = basesimp[linea->dbValue ( "ivalalbaran" ) ] + base; basesimpreqeq[linea->dbValue ( "reqeqlalbaran" ) ] = basesimpreqeq[linea->dbValue ( "reqeqlalbaran" ) ] + base; } // end for BlFixed basei ( "0.00" ); base::Iterator it; for ( it = basesimp.begin(); it != basesimp.end(); ++it ) { basei = basei + it.value(); } // end for /// Calculamos el total de los descuentos. /// De momento aqui no se usan descuentos generales en venta. BlFixed porcentt ( "0.00" ); /// Calculamos el total de base imponible. BlFixed totbaseimp ( "0.00" ); BlFixed parbaseimp ( "0.00" ); for ( it = basesimp.begin(); it != basesimp.end(); ++it ) { if ( porcentt > BlFixed ( "0.00" ) ) { parbaseimp = it.value() - it.value() * porcentt / 100; } else { parbaseimp = it.value(); } // end if totbaseimp = totbaseimp + parbaseimp; } // end for /// Calculamos el total de IVA. BlFixed totiva ( "0.00" ); BlFixed pariva ( "0.00" ); for ( it = basesimp.begin(); it != basesimp.end(); ++it ) { BlFixed piva ( it.key().toAscii().constData() ); if ( porcentt > BlFixed ( "0.00" ) ) { pariva = ( it.value() - it.value() * porcentt / 100 ) * piva / 100; } else { pariva = it.value() * piva / 100; } // end if totiva = totiva + pariva; } // end for /// Calculamos el total de recargo de equivalencia. BlFixed totreqeq ( "0.00" ); BlFixed parreqeq ( "0.00" ); for ( it = basesimpreqeq.begin(); it != basesimpreqeq.end(); ++it ) { BlFixed preqeq ( it.key().toAscii().constData() ); if ( porcentt > BlFixed ( "0.00" ) ) { parreqeq = ( it.value() - it.value() * porcentt / 100 ) * preqeq / 100; } else { parreqeq = it.value() * preqeq / 100; } // end if totreqeq = totreqeq + parreqeq; } // end for BlFixed totirpf = totbaseimp * irpf / 100; BlFixed total = totbaseimp; mui_total->setText ( total.toQString() ); }
void Player::drawInventory(sf::RenderWindow& rw) const { static bool firstRun = true; static sf::Image tlo; static sf::Font font; if(firstRun) { tlo.LoadFromFile("Images/inv.png"); firstRun = false; font.LoadFromFile("silesiana.otf", 50, L"A�BC�DE�FGHIJKL�MN�O�PRS�TUWYZ��a�bc�de�fghijkl�mn�o�prs�tuwyz��XxVvQq0123456789~!@#$%^&*()_-[]\\;',./{}:\"<>?=-+ "); } sf::Sprite tloH(tlo); rw.Draw(tloH); std::stringstream ss; ss<<"Masz " << coins << " $"; sf::String t(ss.str(), font, 30.f); t.SetColor(sf::Color(20, 18, 160)); t.SetPosition(600.f, 30.f); rw.Draw(t); float posy = 30.0; int i = 0; for(std::vector<Item>::const_iterator it = inventory.begin(); it != inventory.end(); it++) { std::wstring name = it->getName(); if(i == weapon) { name += L" (uzbrojny - bro�)"; } if(i == armor) { name += L" (uzbrojny - zbroja)"; } sf::String t(name, font, 30.f); t.SetColor(sf::Color(20, 18, 160)); if(selectedItem == i) t.SetColor(sf::Color(200, 18, 160)); t.SetPosition(20.f, posy); rw.Draw(t); posy += 30.0; i++; } if(0 <= selectedItem && selectedItem < inventory.size()) { TextArea desc(inventory[selectedItem].getDesc(), 400, font); desc.SetPosition(300, 50); rw.Draw(desc); Item::Type type = inventory[selectedItem].getProperty(); if(type == 0) { TextArea desc1(L"Bron - Atak + " +inventory[selectedItem].getBoost(), 400,font); desc1.SetPosition(350,250); rw.Draw(desc1); } else if(type == 1) { TextArea desc1(L"Zbroja - Obrona + " +inventory[selectedItem].getBoost(), 400,font); desc1.SetPosition(350,250); rw.Draw(desc1); } else if(type == 2) { TextArea desc1(L"Helm - Obrona + " +inventory[selectedItem].getBoost(), 400,font); desc1.SetPosition(350,250); rw.Draw(desc1); } else if(type == 3) { TextArea desc1(L"Mikstura", 460,font); desc1.SetPosition(350,250); rw.Draw(desc1); } } }
void MTicketDesglose::pintar() { BL_FUNC_DEBUG BtTicket *tick = ( ( BtCompany * ) mainCompany() ) ->ticketActual(); //QString html = "<font size=\"1\">"; QString html = "<p style=\"font-family:monospace; font-size: 12pt;\">"; QString html1 = "<font size=\"1\">"; html1 += "Ticket: " + tick->dbValue ( "nomticket" ) + "<BR>"; QString querytrab = "SELECT * FROM trabajador WHERE idtrabajador = " + tick->dbValue ( "idtrabajador" ); BlDbRecordSet *curtrab = mainCompany() ->loadQuery ( querytrab ); html1 += "Trabajador: " + tick->dbValue ( "idtrabajador" ) + " " + curtrab->value( "nomtrabajador" ) + "<BR>"; delete curtrab; QString query = "SELECT * FROM cliente WHERE idcliente = " + tick->dbValue ( "idcliente" ); BlDbRecordSet *cur1 = mainCompany() ->loadQuery ( query ); html1 += "Cliente: " + tick->dbValue ( "idcliente" ) + " " + cur1->value( "nomcliente" ) + "<BR>"; delete cur1; html += "<TABLE border=\"0\">"; BlDbRecord *item; for ( int i = 0; i < tick->listaLineas() ->size(); ++i ) { item = tick->listaLineas() ->at ( i ); QString bgcolor = "#FFFFFF"; if ( item == tick->lineaActBtTicket() ) bgcolor = "#CCCCFF"; html += "<TR>"; html += "<TD bgcolor=\"" + bgcolor + "\" align=\"right\" width=\"50\">" + item->dbValue ( "cantlalbaran" ) + "</TD>"; html += "<TD bgcolor=\"" + bgcolor + "\">" + item->dbValue ( "nomarticulo" ) + "</TD>"; BlFixed totalLinea ( "0.00" ); totalLinea = BlFixed ( item->dbValue ( "cantlalbaran" ) ) * BlFixed ( item->dbValue ( "pvplalbaran" ) ); html += "<TD bgcolor=\"" + bgcolor + "\" align=\"right\" width=\"50\">" + totalLinea.toQString() + "</TD>"; html += "</TR>"; }// end for html += "</TABLE>"; // ====================================== html += "<BR><HR><BR>"; base basesimp; base basesimpreqeq; BlDbRecord *linea; /// Impresion de los contenidos. QString l; BlFixed irpf ( "0" ); BlDbRecordSet *cur = mainCompany() ->loadQuery ( "SELECT * FROM configuracion WHERE nombre = 'IRPF'" ); if ( cur ) { if ( !cur->eof() ) { irpf = BlFixed ( cur->value( "valor" ) ); } // end if delete cur; } // end if BlFixed descuentolinea ( "0.00" ); for ( int i = 0; i < tick->listaLineas() ->size(); ++i ) { linea = tick->listaLineas() ->at ( i ); BlFixed cant ( linea->dbValue ( "cantlalbaran" ) ); BlFixed pvpund ( linea->dbValue ( "pvplalbaran" ) ); BlFixed desc1 ( linea->dbValue ( "descuentolalbaran" ) ); BlFixed cantpvp = cant * pvpund; BlFixed base = cantpvp - cantpvp * desc1 / 100; descuentolinea = descuentolinea + ( cantpvp * desc1 / 100 ); basesimp[linea->dbValue ( "ivalalbaran" ) ] = basesimp[linea->dbValue ( "ivalalbaran" ) ] + base; basesimpreqeq[linea->dbValue ( "reqeqlalbaran" ) ] = basesimpreqeq[linea->dbValue ( "reqeqlalbaran" ) ] + base; } // end for BlFixed basei ( "0.00" ); base::Iterator it; for ( it = basesimp.begin(); it != basesimp.end(); ++it ) { basei = basei + it.value(); } // end for /// Calculamos el total de los descuentos. /// De momento aqui no se usan descuentos generales en venta. BlFixed porcentt ( "0.00" ); /* BlDbSubFormRecord *linea1; if (m_listadescuentos->rowCount()) { for (int i = 0; i < m_listadescuentos->rowCount(); ++i) { linea1 = m_listadescuentos->lineaat(i); BlFixed propor(linea1->dbValue("proporcion" + m_listadescuentos->tableName()).toAscii().constData()); porcentt = porcentt + propor; } // end for } // end if */ /// Calculamos el total de base imponible. BlFixed totbaseimp ( "0.00" ); BlFixed parbaseimp ( "0.00" ); for ( it = basesimp.begin(); it != basesimp.end(); ++it ) { if ( porcentt > BlFixed ( "0.00" ) ) { parbaseimp = it.value() - it.value() * porcentt / 100; } else { parbaseimp = it.value(); } // end if html1 += "Base Imp " + it.key() + "% " + parbaseimp.toQString() + "<BR>"; totbaseimp = totbaseimp + parbaseimp; } // end for /// Calculamos el total de IVA. BlFixed totiva ( "0.00" ); BlFixed pariva ( "0.00" ); for ( it = basesimp.begin(); it != basesimp.end(); ++it ) { BlFixed piva ( it.key().toAscii().constData() ); if ( porcentt > BlFixed ( "0.00" ) ) { pariva = ( it.value() - it.value() * porcentt / 100 ) * piva / 100; } else { pariva = it.value() * piva / 100; } // end if html1 += "IVA " + it.key() + "% " + pariva.toQString() + "<BR>"; totiva = totiva + pariva; } // end for /// Calculamos el total de recargo de equivalencia. BlFixed totreqeq ( "0.00" ); BlFixed parreqeq ( "0.00" ); for ( it = basesimpreqeq.begin(); it != basesimpreqeq.end(); ++it ) { BlFixed preqeq ( it.key().toAscii().constData() ); if ( porcentt > BlFixed ( "0.00" ) ) { parreqeq = ( it.value() - it.value() * porcentt / 100 ) * preqeq / 100; } else { parreqeq = it.value() * preqeq / 100; } // end if html1 += "R.Eq " + it.key() + "% " + parreqeq.toQString() + "<BR>"; totreqeq = totreqeq + parreqeq; } // end for BlFixed totirpf = totbaseimp * irpf / 100; html1 += "<B>Base Imp. " + totbaseimp.toQString() + "<BR>"; html1 += "<B>IVA. " + totiva.toQString() + "<BR>"; html1 += "<B>IRPF. " + totirpf.toQString() + "<BR>"; BlFixed total = totiva + totbaseimp + totreqeq - totirpf; html1 += "<B>Total: " + total.toQString() + "<BR>"; html += "</p>"; html1 += "</FONT>"; // ====================================== /// Pintamos el HTML en el textBrowser setText ( html1 ); }
void Devolucion::pintar() { if ( !m_ticket ) return; // ====================== PINTAMOS ======================== QString html = "<p style=\"font-family:monospace; font-size: 8pt;\">"; QString html1 = "<font size=\"1\">"; html1 += "Ticket: " + m_ticket->dbValue ( "nomticket" ) + "<BR>"; QString querytrab = "SELECT * FROM trabajador WHERE idtrabajador = " + m_ticket->dbValue ( "idtrabajador" ); BlDbRecordSet *curtrab = mainCompany() ->loadQuery ( querytrab ); html1 += "Trabajador: " + m_ticket->dbValue ( "idtrabajador" ) + " " + curtrab->value( "nomtrabajador" ) + "<BR>"; delete curtrab; QString query = "SELECT * FROM cliente WHERE idcliente = " + m_ticket->dbValue ( "idcliente" ); BlDbRecordSet *cur1 = mainCompany() ->loadQuery ( query ); html1 += "Cliente: " + m_ticket->dbValue ( "idcliente" ) + " " + cur1->value( "nomcliente" ) + "<BR>"; delete cur1; if ( m_ticket->listaLineas()->size() > 0 ) { html += "<TABLE border=\"0\">"; html += "<TR bgcolor = \"#CCCCCC\">"; html += "<TD>SEL</TD>"; for ( int z = 0; z < m_ticket->listaLineas()->at ( 0 )->lista()->size(); ++z ) { BlDbField *head = m_ticket->listaLineas()->at ( 0 )->lista()->at ( z ); if ( head->fieldName().left ( 2 ) != "id" && head->fieldName().left ( 3 ) != "num" ) html += "<TD>" + head->fieldName().left ( 4 ) + "</TD>"; } // end for html += "</TR>"; BlDbRecord *item; for ( int i = 0; i < m_ticket->listaLineas() ->size(); ++i ) { item = m_ticket->listaLineas() ->at ( i ); html += "<TR>"; html += "<TD><A NAME=\"plus\" HREF=\"?op=plus&numlalbaran=" + item->dbValue ( "numlalbaran" ) + "\">+</A> <A HREF=\"?op=minus&numlalbaran=" + item->dbValue ( "numlalbaran" ) + "\">-</A></td>"; for ( int j = 0; j < item->lista()->size(); ++j ) { BlDbField *camp = item->lista()->at ( j ); if ( camp->fieldName().left ( 2 ) != "id" && camp->fieldName().left ( 3 ) != "num" ) html += "<TD>" + camp->fieldValue() + "</TD>"; } // end for html += "</TR>"; }// end for html += "</TABLE>"; } // end if // ====================================== html += "<BR><HR><BR>"; base basesimp; base basesimpreqeq; BlDbRecord *linea; /// Impresion de los contenidos. QString l; BlFixed irpf ( "0" ); BlDbRecordSet *cur = mainCompany() ->loadQuery ( "SELECT * FROM configuracion WHERE nombre = 'IRPF'" ); if ( cur ) { if ( !cur->eof() ) { irpf = BlFixed ( cur->value( "valor" ) ); } // end if delete cur; } // end if BlFixed descuentolinea ( "0.00" ); for ( int i = 0; i < m_ticket->listaLineas() ->size(); ++i ) { linea = m_ticket->listaLineas() ->at ( i ); BlFixed cant ( linea->dbValue ( "cantlalbaran" ) ); BlFixed pvpund ( linea->dbValue ( "pvplalbaran" ) ); BlFixed desc1 ( linea->dbValue ( "descuentolalbaran" ) ); BlFixed cantpvp = cant * pvpund; BlFixed base = cantpvp - cantpvp * desc1 / 100; descuentolinea = descuentolinea + ( cantpvp * desc1 / 100 ); basesimp[linea->dbValue ( "ivalalbaran" ) ] = basesimp[linea->dbValue ( "ivalalbaran" ) ] + base; basesimpreqeq[linea->dbValue ( "reqeqlalbaran" ) ] = basesimpreqeq[linea->dbValue ( "reqeqlalbaran" ) ] + base; } // end for BlFixed basei ( "0.00" ); base::Iterator it; for ( it = basesimp.begin(); it != basesimp.end(); ++it ) { basei = basei + it.value(); } // end for /// Calculamos el total de los descuentos. /// De momento aqui no se usan descuentos generales en venta. BlFixed porcentt ( "0.00" ); /// Calculamos el total de base imponible. BlFixed totbaseimp ( "0.00" ); BlFixed parbaseimp ( "0.00" ); for ( it = basesimp.begin(); it != basesimp.end(); ++it ) { if ( porcentt > BlFixed ( "0.00" ) ) { parbaseimp = it.value() - it.value() * porcentt / 100; } else { parbaseimp = it.value(); } // end if html1 += "Base Imp " + it.key() + "% " + parbaseimp.toQString() + "<BR>"; totbaseimp = totbaseimp + parbaseimp; } // end for /// Calculamos el total de IVA. BlFixed totiva ( "0.00" ); BlFixed pariva ( "0.00" ); for ( it = basesimp.begin(); it != basesimp.end(); ++it ) { BlFixed piva ( it.key().toLatin1().constData() ); if ( porcentt > BlFixed ( "0.00" ) ) { pariva = ( it.value() - it.value() * porcentt / 100 ) * piva / 100; } else { pariva = it.value() * piva / 100; } // end if html1 += "IVA " + it.key() + "% " + pariva.toQString() + "<BR>"; totiva = totiva + pariva; } // end for /// Calculamos el total de recargo de equivalencia. BlFixed totreqeq ( "0.00" ); BlFixed parreqeq ( "0.00" ); for ( it = basesimpreqeq.begin(); it != basesimpreqeq.end(); ++it ) { BlFixed preqeq ( it.key().toLatin1().constData() ); if ( porcentt > BlFixed ( "0.00" ) ) { parreqeq = ( it.value() - it.value() * porcentt / 100 ) * preqeq / 100; } else { parreqeq = it.value() * preqeq / 100; } // end if html1 += "R.Eq " + it.key() + "% " + parreqeq.toQString() + "<BR>"; totreqeq = totreqeq + parreqeq; } // end for BlFixed totirpf = totbaseimp * irpf / 100; html1 += "<B>Base Imp. " + totbaseimp.toQString() + "<BR>"; html1 += "<B>IVA. " + totiva.toQString() + "<BR>"; html1 += "<B>IRPF. " + totirpf.toQString() + "<BR>"; BlFixed total = totiva + totbaseimp + totreqeq - totirpf; html1 += "<B>Total: " + total.toQString() + "<BR>"; html += "</p>"; html1 += "</FONT>"; if ( m_totalin == "" ) { mui_total->setText ( total.toQString() ); m_totalin = total.toQString(); } mui_newtotal->setText ( total.toQString() ); BlFixed diff ( m_totalin ); diff = diff - total; mui_difprice->setText ( diff.toQString() ); // ====================================== /// Pintamos el HTML en el textBrowser mui_browser->setText ( html ); }
int main(int argc, char *argv[]) { /* sf::RenderWindow app(sf::VideoMode(640, 480), "ECS"); sf::RectangleShape rectangle(sf::Vector2f(50.f, 50.f)); rectangle.setFillColor(sf::Color::Blue); sf::RectangleShape rectangle2(sf::Vector2f(50.f, 50.f)); rectangle2.setFillColor(sf::Color::Red); GameObject objects[2]; DescriptionSystem desc_sys; MovementSystem move_sys; RenderSystem renderer(&app); CollisionSystem collision_sys; DescriptionComponent desc(objects[0].getId()); PositionComponent pos(objects[0].getId()), pos2(objects[1].getId()); VelocityComponent vel(objects[0].getId(), 1.f), vel2(objects[1].getId(), 0.2f, 0.1f); DrawableComponent drawable(objects[0].getId()), drawable2(objects[1].getId()); CollidableComponent c1(objects[0].getId(), rectangle.getGlobalBounds()), c2(objects[1].getId(), rectangle2.getGlobalBounds()); drawable.drawable = &rectangle; drawable2.drawable = &rectangle2; //pos.position.y = 50.f; pos2.position.x = 250.f; pos2.position.y = 20.f; desc_sys.registerComponent("Description"); move_sys.registerComponent("Position"); move_sys.registerComponent("Velocity"); renderer.registerComponent("Drawable"); renderer.registerComponent("Position"); collision_sys.registerComponent("Position"); collision_sys.registerComponent("Collidable"); objects[0].addComponent(&desc); objects[0].addComponent(&pos); objects[0].addComponent(&vel); objects[0].addComponent(&drawable); objects[0].addComponent(&c1); objects[1].addComponent(&vel2); objects[1].addComponent(&drawable2); objects[1].addComponent(&pos2); objects[1].addComponent(&c2); if (desc_sys.canUpdate(objects[0])) desc_sys.update(objects[0]); sf::Event event; while (app.isOpen()) { while (app.pollEvent(event)) { if (event.type == sf::Event::Closed) app.close(); } for (int i(0) ; i < 2 ; ++i) if (move_sys.canUpdate(objects[i])) move_sys.update(objects[i]); app.clear(sf::Color::White); for (int i(0) ; i < 2 ; ++i) if (collision_sys.canUpdate(objects[i])) collision_sys.update(objects[i]); for (int i(0) ; i < 2 ; ++i) if (renderer.canUpdate(objects[i])) renderer.update(objects[i]); app.display(); } */ GameWorld world; GameObject *o1(world.addObject()); GameObject *o2(world.addObject()); sf::RectangleShape rectangle1(sf::Vector2f(50.f, 50.f)); rectangle1.setFillColor(sf::Color::Blue); sf::RectangleShape rectangle2(sf::Vector2f(50.f, 50.f)); rectangle2.setFillColor(sf::Color::Red); PhysicSystem *phys_sys(new PhysicSystem); phys_sys->registerComponent("Physic"); phys_sys->registerComponent("Position"); world.addSystem(phys_sys); PhysicComponent phys1(o1->getId(), 50, cpMomentForBox(50, 5, 5)), phys2(o2->getId(), 50, cpMomentForBox(50, 5, 5)); DescriptionComponent desc1(o1->getId()), desc2(o2->getId()); PositionComponent pos1(o1->getId()), pos2(o2->getId()); //VelocityComponent vel1(objects[0].getId(), 1.f), vel2(objects[1].getId(), 0.2f, 0.1f); DrawableComponent drawable1(o1->getId()), drawable2(o2->getId()); //CollidableComponent c1(objects[0].getId(), rectangle.getGlobalBounds()), c2(objects[1].getId(), rectangle2.getGlobalBounds()); phys1.shape = cpBoxShapeNew(phys1.body, 50.f, 50.f); phys2.shape = cpBoxShapeNew(phys2.body, 50.f, 50.f); cpBodySetPos(phys1.body, cpv(0, 0)); cpBodySetPos(phys2.body, cpv(200, 0)); cpSpaceAddShape(phys_sys->getSpace(), phys1.shape); cpSpaceAddShape(phys_sys->getSpace(), phys2.shape); cpSpaceAddBody(phys_sys->getSpace(), phys1.body); cpSpaceAddBody(phys_sys->getSpace(), phys2.body); drawable1.drawable = &rectangle1; drawable2.drawable = &rectangle2; pos1.position.x = 50.f; pos2.position = sf::Vector2f(200.f, 150.f); o1->addComponent(&desc1); o1->addComponent(&drawable1); o1->addComponent(&pos1); o1->addComponent(&phys1); o2->addComponent(&desc2); o2->addComponent(&drawable2); o2->addComponent(&pos2); o2->addComponent(&phys2); while (true) { world.update(); } return 0; }
void wxPropertyGridManager::RecreateControls() { bool was_shown = IsShown(); if ( was_shown ) Show ( false ); wxWindowID baseId = m_pPropGrid->GetId(); if ( baseId < 0 ) baseId = wxPG_MAN_ALTERNATE_BASE_ID; #if wxUSE_TOOLBAR if ( m_windowStyle & wxPG_TOOLBAR ) { // Has toolbar. if ( !m_pToolbar ) { m_pToolbar = new wxToolBar(this,baseId+ID_ADVTOOLBAR_OFFSET, wxDefaultPosition,wxDefaultSize, ((GetExtraStyle()&wxPG_EX_NO_FLAT_TOOLBAR)?0:wxTB_FLAT) /*| wxTB_HORIZONTAL | wxNO_BORDER*/ ); m_pToolbar->SetToolBitmapSize(wxSize(16, 15)); #if defined(__WXMSW__) // Eliminate toolbar flicker on XP // NOTE: Not enabled since it corrupts drawing somewhat. /* #ifndef WS_EX_COMPOSITED #define WS_EX_COMPOSITED 0x02000000L #endif HWND hWnd = (HWND)m_pToolbar->GetHWND(); ::SetWindowLong( hWnd, GWL_EXSTYLE, ::GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_COMPOSITED ); */ #endif m_pToolbar->SetCursor ( *wxSTANDARD_CURSOR ); if ( (GetExtraStyle()&wxPG_EX_MODE_BUTTONS) ) { wxString desc1(_("Categorized Mode")); wxString desc2(_("Alphabetic Mode")); m_pToolbar->AddTool(baseId+ID_ADVTBITEMSBASE_OFFSET+0, desc1,wxBitmap ( (const char**)gs_xpm_catmode ), desc1,wxITEM_RADIO); m_pToolbar->AddTool(baseId+ID_ADVTBITEMSBASE_OFFSET+1, desc2,wxBitmap ( (const char**)gs_xpm_noncatmode ), desc2,wxITEM_RADIO); m_pToolbar->Realize(); } } if ( (GetExtraStyle()&wxPG_EX_MODE_BUTTONS) ) { // Toggle correct mode button. // TODO: This doesn't work in wxMSW (when changing, // both items will get toggled). int toggle_but_on_ind = ID_ADVTBITEMSBASE_OFFSET+0; int toggle_but_off_ind = ID_ADVTBITEMSBASE_OFFSET+1; if ( m_pPropGrid->m_pState->IsInNonCatMode() ) { toggle_but_on_ind++; toggle_but_off_ind--; } m_pToolbar->ToggleTool(baseId+toggle_but_on_ind,true); m_pToolbar->ToggleTool(baseId+toggle_but_off_ind,false); } } else { // No toolbar. if ( m_pToolbar ) m_pToolbar->Destroy(); m_pToolbar = NULL; } #endif if ( m_windowStyle & wxPG_DESCRIPTION ) { // Has help box. m_pPropGrid->m_iFlags |= (wxPG_FL_NOSTATUSBARHELP); if ( !m_pTxtHelpCaption ) { m_pTxtHelpCaption = new wxStaticText(this, baseId+ID_ADVHELPCAPTION_OFFSET, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT|wxST_NO_AUTORESIZE); m_pTxtHelpCaption->SetFont( m_pPropGrid->m_captionFont ); m_pTxtHelpCaption->SetCursor( *wxSTANDARD_CURSOR ); } if ( !m_pTxtHelpContent ) { m_pTxtHelpContent = new wxStaticText(this, baseId+ID_ADVHELPCONTENT_OFFSET, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT|wxST_NO_AUTORESIZE); m_pTxtHelpContent->SetCursor( *wxSTANDARD_CURSOR ); } SetDescribedProperty(GetSelection()); } else { // No help box. m_pPropGrid->m_iFlags &= ~(wxPG_FL_NOSTATUSBARHELP); if ( m_pTxtHelpCaption ) m_pTxtHelpCaption->Destroy(); m_pTxtHelpCaption = NULL; if ( m_pTxtHelpContent ) m_pTxtHelpContent->Destroy(); m_pTxtHelpContent = NULL; } int width, height; GetClientSize(&width,&height); RecalculatePositions(width,height); if ( was_shown ) Show ( true ); }
int MTicketIVAInc_pintar ( MTicketIVAInc *mtick ) { BL_FUNC_DEBUG QString query; QString buscar; BtTicket *tick = ( ( BtCompany * ) mtick->mainCompany() )->ticketActual(); QString plainTextContent = ""; QString htmlContent = "<font size=\"4\", font-family:monospace>"; htmlContent += "Ticket: " + tick->dbValue ( "nomticket" ) + "<BR>"; plainTextContent += "Ticket: " + tick->dbValue ( "nomticket" ) + "\n"; query = "SELECT idtrabajador, nomtrabajador FROM trabajador WHERE idtrabajador = " + tick->dbValue ( "idtrabajador" ); BlDbRecordSet *rsTrabajador = mtick->mainCompany()->loadQuery ( query ); plainTextContent += "Trabajador: " + rsTrabajador->value( "nomtrabajador" ) + "\n"; htmlContent += "Trabajador: " + rsTrabajador->value( "nomtrabajador" ) + "<br>"; delete rsTrabajador; query = "SELECT idcliente, nomcliente FROM cliente WHERE idcliente = " + tick->dbValue ( "idcliente" ); BlDbRecordSet *rsCliente = mtick->mainCompany()->loadQuery ( query ); plainTextContent += "Cliente: " + rsCliente->value( "nomcliente" ) + "\n"; htmlContent += "Cliente: " + rsCliente->value( "nomcliente" ) + "<br>"; delete rsCliente; htmlContent += "<br>"; htmlContent += "<TABLE border=\"0\" width=\"100%\">"; htmlContent += "<tr><td>" + QString(_("CANT:")) + "</td><td width=\"30%\">" + QString(_("ARTI:")) + "</td><td>" + QString(_("TALLA:")) + "</td><td>" + QString(_("COLOR:")) + "</td><td>" + QString(_("PREC:")) + "</td></tr>"; htmlContent += "<tr><td colspan=\"5\" width=\"100%\" ><hr></td></tr>"; plainTextContent += "\n"; plainTextContent += " " + QString(_("CANT:").rightJustified( 7, ' ', true )) + " " + QString(_("ARTI:").leftJustified ( 15, ' ', true )) + " " + QString(_("TALLA:").leftJustified( 7, ' ', true ))+ " " + QString(_("COLOR:").leftJustified( 7, ' ', true ))+ " " + QString(_("PRECIO:").leftJustified( 9, ' ', true )) + "\n"; plainTextContent += "-----------------------------------------------------------\n"; // if (tick->dbValue("nomticket") != "") { // htmlContent += "<TR><TD colspan=\"5\" align=\"center\"><B>" + tick->dbValue ( "nomticket" ) + "</B></td></tr>"; // } // end if BlDbRecord *item; for ( int i = 0; i < tick->listaLineas()->size(); ++i ) { item = tick->listaLineas()->at ( i ); QString bgcolor = "#FFFFFF"; if ( item == tick->lineaActBtTicket() ) { buscar = item->dbValue ( "nomarticulo" ); bgcolor = "#CCCCFF"; plainTextContent += "> "; } else { plainTextContent += " "; } // end if htmlContent += "<TR>"; htmlContent += "<TD bgcolor=\"" + bgcolor + "\" align=\"right\" width=\"50\">" + item->dbValue ( "cantlalbaran" ) + "</TD>"; htmlContent += "<TD bgcolor=\"" + bgcolor + "\" whidth>" + item->dbValue ( "nomarticulo" ) + "</TD>"; htmlContent += "<TD bgcolor=\"" + bgcolor + "\">" + item->dbValue ( "nomtc_talla" ) + "</TD>"; htmlContent += "<TD bgcolor=\"" + bgcolor + "\">" + item->dbValue ( "nomtc_color" ) + "</TD>"; BlFixed totalLinea ( "0.00" ); totalLinea = BlFixed ( item->dbValue ( "cantlalbaran" ) ) * BlFixed ( item->dbValue ( "pvpivainclalbaran" ) ); htmlContent += "<TD bgcolor=\"" + bgcolor + "\" align=\"right\" width=\"50\">" + totalLinea.toQString() + "</TD>"; htmlContent += "</TR>"; plainTextContent += item->dbValue("cantlalbaran").rightJustified ( 7, ' ', true ) + " "; plainTextContent += item->dbValue("nomarticulo").leftJustified ( 20, ' ', true ) + " "; plainTextContent += item->dbValue("nomtc_talla").leftJustified ( 7, ' ', true ) + " "; plainTextContent += item->dbValue("nomtc_color").leftJustified ( 7, ' ', true ) + " "; plainTextContent += totalLinea.toQString().leftJustified ( 9, ' ', true ) + "\n"; } // end for htmlContent+= "</TABLE>"; htmlContent += "<HR>"; base basesimp; base basesimpreqeq; BlDbRecord *linea; QString l; BlFixed irpf ( "0" ); BlDbRecordSet *cur = mtick->mainCompany()->loadQuery ( "SELECT * FROM configuracion WHERE nombre = 'IRPF'" ); if ( cur ) { if ( !cur->eof() ) { irpf = BlFixed ( cur->value( "valor" ) ); } // end if delete cur; } // end if BlFixed descuentolinea ( "0.00" ); for ( int i = 0; i < tick->listaLineas()->size(); ++i ) { linea = tick->listaLineas()->at ( i ); BlFixed cant ( linea->dbValue ( "cantlalbaran" ) ); BlFixed pvpund ( linea->dbValue ( "pvpivainclalbaran" ) ); BlFixed desc1 ( linea->dbValue ( "descuentolalbaran" ) ); BlFixed cantpvp = cant * pvpund; BlFixed iva ( linea->dbValue ( "ivalalbaran" ) ); BlFixed base = cantpvp - cantpvp * desc1 / 100; base = base / ( BlFixed ( "1" ) + ( iva / BlFixed ( "100" ) ) ); descuentolinea = descuentolinea + ( cantpvp * desc1 / 100 ); basesimp[linea->dbValue ( "ivalalbaran" ) ] = basesimp[linea->dbValue ( "ivalalbaran" ) ] + base; basesimpreqeq[linea->dbValue ( "reqeqlalbaran" ) ] = basesimpreqeq[linea->dbValue ( "reqeqlalbaran" ) ] + base; } // end for BlFixed basei ( "0.00" ); base::Iterator it; for ( it = basesimp.begin(); it != basesimp.end(); ++it ) { basei = basei + it.value(); } // end for mtick->mui_browser->setText ( htmlContent ); mtick->mui_plainText->setPlainText ( plainTextContent ); mtick->mui_browser->find ( buscar ); QTextCursor cursor = mtick->mui_browser->textCursor(); cursor.clearSelection(); mtick->mui_browser->setTextCursor( cursor ); return -1; // BtTicket *tick = ( ( BtCompany * ) mtick->mainCompany() )->ticketActual(); // QString html = "<p style=\"font-family:monospace; font-size: 12pt;\">"; // QString html1 = "<font size=\"1\">"; // // html1 += "Ticket: " + tick->dbValue ( "nomticket" ) + "<BR>"; // // QString querytrab = "SELECT * FROM trabajador WHERE idtrabajador = " + tick->dbValue ( "idtrabajador" ); // BlDbRecordSet *curtrab = mtick->mainCompany()->loadQuery ( querytrab ); // html1 += "Trabajador: " + tick->dbValue ( "idtrabajador" ) + " " + curtrab->value( "nomtrabajador" ) + "<BR>"; // delete curtrab; // // QString query = "SELECT * FROM cliente WHERE idcliente = " + tick->dbValue ( "idcliente" ); // BlDbRecordSet *cur1 = mtick->mainCompany()->loadQuery ( query ); // html1 += "Cliente: " + tick->dbValue ( "idcliente" ) + " " + cur1->value( "nomcliente" ) + "<BR>"; // delete cur1; // // html += "<TABLE border=\"0\" width=\"100%\">"; // if (tick->dbValue("nomticket") != "") { // html += "<TR><TD colspan=\"5\" align=\"center\"><B>" + tick->dbValue ( "nomticket" ) + "</B></td></tr>"; // } // end if // // BlDbRecord *item; // for ( int i = 0; i < tick->listaLineas()->size(); ++i ) { // item = tick->listaLineas()->at ( i ); // QString bgcolor = "#FFFFFF"; // if ( item == tick->lineaActBtTicket() ) bgcolor = "#CCCCFF"; // html += "<TR>"; // html += "<TD bgcolor=\"" + bgcolor + "\" align=\"right\" width=\"50\">" + item->dbValue ( "cantlalbaran" ) + "</TD>"; // html += "<TD bgcolor=\"" + bgcolor + "\">" + item->dbValue ( "nomarticulo" ) + "</TD>"; // html += "<TD bgcolor=\"" + bgcolor + "\">" + item->dbValue ( "nomtc_talla" ) + "</TD>"; // html += "<TD bgcolor=\"" + bgcolor + "\">" + item->dbValue ( "nomtc_color" ) + "</TD>"; // BlFixed totalLinea ( "0.00" ); // totalLinea = BlFixed ( item->dbValue ( "cantlalbaran" ) ) * BlFixed ( item->dbValue ( "pvpivainclalbaran" ) ); // html += "<TD bgcolor=\"" + bgcolor + "\" align=\"right\" width=\"50\">" + totalLinea.toQString() + "</TD>"; // html += "</TR>"; // } // end for // // html += "</TABLE>"; // html += "<BR><HR><BR>"; // base basesimp; // base basesimpreqeq; // BlDbRecord *linea; // // /// Impresion de los contenidos. // QString l; // BlFixed irpf ( "0" ); // // BlDbRecordSet *cur = mtick->mainCompany()->loadQuery ( "SELECT * FROM configuracion WHERE nombre = 'IRPF'" ); // // if ( cur ) { // if ( !cur->eof() ) { // irpf = BlFixed ( cur->value( "valor" ) ); // } // end if // delete cur; // } // end if // // BlFixed descuentolinea ( "0.00" ); // // for ( int i = 0; i < tick->listaLineas()->size(); ++i ) { // linea = tick->listaLineas()->at ( i ); // BlFixed cant ( linea->dbValue ( "cantlalbaran" ) ); // BlFixed pvpund ( linea->dbValue ( "pvpivainclalbaran" ) ); // BlFixed desc1 ( linea->dbValue ( "descuentolalbaran" ) ); // BlFixed cantpvp = cant * pvpund; // BlFixed iva ( linea->dbValue ( "ivalalbaran" ) ); // BlFixed base = cantpvp - cantpvp * desc1 / 100; // base = base / ( BlFixed ( "1" ) + ( iva / BlFixed ( "100" ) ) ); // descuentolinea = descuentolinea + ( cantpvp * desc1 / 100 ); // basesimp[linea->dbValue ( "ivalalbaran" ) ] = basesimp[linea->dbValue ( "ivalalbaran" ) ] + base; // basesimpreqeq[linea->dbValue ( "reqeqlalbaran" ) ] = basesimpreqeq[linea->dbValue ( "reqeqlalbaran" ) ] + base; // } // end for // // BlFixed basei ( "0.00" ); // base::Iterator it; // // for ( it = basesimp.begin(); it != basesimp.end(); ++it ) { // basei = basei + it.value(); // } // end for // // /// Calculamos el total de los descuentos. // /// De momento aqui no se usan descuentos generales en venta. // BlFixed porcentt ( "0.00" ); // // /// Calculamos el total de base imponible. // BlFixed totbaseimp ( "0.00" ); // BlFixed parbaseimp ( "0.00" ); // // for ( it = basesimp.begin(); it != basesimp.end(); ++it ) { // if ( porcentt > BlFixed ( "0.00" ) ) { // parbaseimp = it.value() - it.value() * porcentt / 100; // } else { // parbaseimp = it.value(); // } // end if // html1 += "Base Imp " + it.key() + "% " + parbaseimp.toQString() + "<BR>"; // totbaseimp = totbaseimp + parbaseimp; // } // end for // // /// Calculamos el total de IVA. // BlFixed totiva ( "0.00" ); // BlFixed pariva ( "0.00" ); // // for ( it = basesimp.begin(); it != basesimp.end(); ++it ) { // BlFixed piva ( it.key().toLatin1().constData() ); // if ( porcentt > BlFixed ( "0.00" ) ) { // pariva = ( it.value() - it.value() * porcentt / 100 ) * piva / 100; // } else { // pariva = it.value() * piva / 100; // } // end if // html1 += "IVA " + it.key() + "% " + pariva.toQString() + "<BR>"; // totiva = totiva + pariva; // } // end for // // /// Calculamos el total de recargo de equivalencia. // BlFixed totreqeq ( "0.00" ); // BlFixed parreqeq ( "0.00" ); // // for ( it = basesimpreqeq.begin(); it != basesimpreqeq.end(); ++it ) { // BlFixed preqeq ( it.key().toLatin1().constData() ); // if ( porcentt > BlFixed ( "0.00" ) ) { // parreqeq = ( it.value() - it.value() * porcentt / 100 ) * preqeq / 100; // } else { // parreqeq = it.value() * preqeq / 100; // } // end if // html1 += "R.Eq " + it.key() + "% " + parreqeq.toQString() + "<BR>"; // totreqeq = totreqeq + parreqeq; // } // end for // // BlFixed totirpf = totbaseimp * irpf / 100; // // html1 += "<B>Base Imp. " + totbaseimp.toQString() + "<BR>"; // html1 += "<B>IVA. " + totiva.toQString() + "<BR>"; // html1 += "<B>IRPF. " + totirpf.toQString() + "<BR>"; // // BlFixed total = totiva + totbaseimp + totreqeq - totirpf; // html1 += "<B>Total: " + total.toQString() + "<BR>"; // // html += "</p>"; // html1 += "</FONT>"; // // /// Pintamos el HTML en el textBrowser // mtick->mui_browser->setText ( html ); // // return -1; }