//--------------------------------------------------------------------------- void __fastcall TQrySaleForm::btnQryYearClick(TObject *Sender) { CString szSQL = ""; ///////////////////////////////////////////////////////////////////////////////////////////// //业绩查询 szSQL = "select op_code_sl, isnull(busi_volume_cur,0) gross, \ dbo.gen_should_com(busi_volume_cur, dbo.gen_new_cli_prize_yearmonth(year_month,op_code_sl), busi_volume_base, ratio) should_com, \ cast(100*(1-isnull(busi_volume_cur,0)/isnull(busi_volume_base,100)) as decimal(9,2)) as pect_busi, \ case sign(busi_volume_base-busi_volume_cur) \ when 1 then (busi_volume_base-busi_volume_cur)\ else 0 end as last_busi,\ *\ from commition \ where 1=1 "; if (g_theOperator.op_class==E_OPERATOR_TYPE_SALER){ szSQL += " and op_code_sl="; szSQL += Str2DBString(g_theOperator.op_code); } if (!cbbYear->Text.IsEmpty()){ szSQL += " and year(year_month)="; szSQL += Str2DBString(cbbYear->Text.c_str()); } if (!cbbMonth->Text.IsEmpty()){ szSQL += " and month(year_month)="; szSQL += Str2DBString(cbbMonth->Text.c_str()); } szSQL += "order by year_month, op_code_sl"; Edit1->Text = AnsiString(szSQL); //run RunSQL(szSQL, true); if (dm1->Query1->Eof){ ShowMessage("记录不存在"); } lvTask->Clear(); //show double sum_should_com = 0; while(!dm1->Query1->Eof) { TListItem *pItem = lvTask->Items->Add(); double should_com = dm1->Query1->FieldByName("should_com")->AsFloat; sum_should_com += should_com; pItem->Caption = dm1->Query1->FieldByName("op_code_sl")->AsString; pItem->SubItems->Add(dm1->Query1->FieldByName("gross")->AsString); pItem->SubItems->Add(should_com); pItem->SubItems->Add(0.85*should_com); pItem->SubItems->Add(0.15*should_com); pItem->SubItems->Add(dm1->Query1->FieldByName("passed")->AsString); pItem->SubItems->Add(dm1->Query1->FieldByName("busi_volume_cur")->AsString); pItem->SubItems->Add(dm1->Query1->FieldByName("last_busi")->AsString); double last_busi = dm1->Query1->FieldByName("pect_busi")->AsFloat; last_busi = last_busi<0?0:last_busi; pItem->SubItems->Add(last_busi); dm1->Query1->Next(); } lbTotalPrize->Caption = 0.85*sum_should_com; ///////////////////////////////////////////////////////////////////////////////////////////// //回扣查询 szSQL = "select *, \ CONVERT(varchar, acceptdate, 111) as date_accept, \ case year(date) when 2099 then '-' else CONVERT(varchar, date, 111) end as date_kb \ from detail_kb, operation \ where dkoid=oid "; if (g_theOperator.op_class==E_OPERATOR_TYPE_SALER){ szSQL += " and op_code_sl="; szSQL += Str2DBString(g_theOperator.op_code); } if (!cbbClShortName->Text.IsEmpty()){ szSQL += " and cl_shortname="; szSQL += Str2DBString(cbbClShortName->Text.c_str()); } if (!cbbYear->Text.IsEmpty()){ szSQL += " and year(acceptdate)="; szSQL += Str2DBString(cbbYear->Text.c_str()); } if (!cbbMonth->Text.IsEmpty()){ szSQL += " and month(acceptdate)="; szSQL += Str2DBString(cbbMonth->Text.c_str()); } RunSQL(szSQL, true); if (dm1->Query1->Eof){ ShowMessage("回扣记录不存在"); } lvKB->Clear(); while(!dm1->Query1->Eof) { TListItem *pItem = lvKB->Items->Add(); pItem->Caption = dm1->Query1->FieldByName("oid")->AsString; pItem->SubItems->Add(dm1->Query1->FieldByName("date_accept")->AsString); pItem->SubItems->Add(dm1->Query1->FieldByName("cl_shortname")->AsString); pItem->SubItems->Add(dm1->Query1->FieldByName("kb_value")->AsFloat); pItem->SubItems->Add(dm1->Query1->FieldByName("date_kb")->AsString); dm1->Query1->Next(); } }
QString PSV_ChartDateTimeItem::getToolTipText(const double x, const double y) { return QString("value = %1\n%2").arg(QString::number(y,'f',decimal())) .arg(getTipDataTextX(x)); }
inline decimal operator-(const decimal& a, const decimal& b) { return decimal(a.value() - b.value()); }
decimal operator-() const { return decimal(-value_); }
static decimal from_int(int64_t v) { return decimal(v*DECIMAL_PRECISION); }
template<> inline string to_string<unsigned int> (const unsigned int& v) { return decimal(v); }
// Compute the point of an object closest to the origin inline Vector3 TriangleEPA::computeClosestPointOfObject(const Vector3* supportPointsOfObject) const{ const Vector3& p0 = supportPointsOfObject[mIndicesVertices[0]]; return p0 + decimal(1.0)/mDet * (mLambda1 * (supportPointsOfObject[mIndicesVertices[1]] - p0) + mLambda2 * (supportPointsOfObject[mIndicesVertices[2]] - p0)); }