本文整理汇总了C++中BlFixed::setPrecision方法的典型用法代码示例。如果您正苦于以下问题:C++ BlFixed::setPrecision方法的具体用法?C++ BlFixed::setPrecision怎么用?C++ BlFixed::setPrecision使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlFixed
的用法示例。
在下文中一共展示了BlFixed::setPrecision方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calculaypintatotales
void TicketClienteView::calculaypintatotales() {
if (!m_listalineas) return;
//blMsgInfo("Calculo y pinto los totales");
/*
* m_totalBases->setText ( base.toQString() );
m_totalTaxes->setText ( iva.toQString() );
m_totalalbaran->setText ( total.toQString() );
m_totalDiscounts->setText ( desc.toQString() );
m_totalIRPF->setText ( QString ( irpf.toQString() ) );
m_totalReqEq->setText ( QString ( reqeq.toQString() ) );
*/
BlFixed total("0.00");
BlFixed impuestos("0.00");
BlFixed bimp("0.00");
BlDbSubFormRecord *linea;
for ( int i = 0; i < m_listalineas->rowCount(); ++i ) {
linea = m_listalineas->lineaat ( i );
BlFixed cant ( linea->dbValue ( "cantlalbaran" ));
BlFixed pvpund ( linea->dbValue ( "pvpivainclalbaran"));
BlFixed ivalin ( linea->dbValue ( "ivalalbaran"));
BlFixed totallinea = cant * pvpund;
totallinea.setPrecision(2);
total = total + totallinea;
BlFixed ivalinea = totallinea - totallinea / (BlFixed("1.00") + (ivalin / BlFixed("100.00")));
ivalinea.setPrecision(2);
impuestos = impuestos + ivalinea;
} // end for
// Calculamos la base imponible
bimp = total - impuestos;
m_totalalbaran->setText( total.toQString());
m_totalTaxes-> setText( impuestos.toQString());
m_totalBases -> setText (bimp.toQString());
}
示例2: _
QString Q19Writer::import ( BlFixed f, int longitud )
{
f.setPrecision ( 2 );
QString res = QString::number ( f.value );
if ( f.value < 0 )
{
throw _ ( "Datos incorrectos" ) +"\n" + _ ( "Importe negativo (%1) ! " ).arg ( f.toQString() );
}
if ( res.length() >longitud )
{
throw _ ( "Datos incorrectos" ) +"\n" + _ ( "Importe excesivo (%1) !. El limite son %2 digitos, incluyendo los 2 decimales " ).arg ( f.toQString() ).arg ( abs ( longitud ) );
}
return res.rightJustified ( longitud,'0',true );
}
示例3: irpf
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;
//.........这里部分代码省略.........