📄 stdpricemst.cpp
字号:
#include "stdafx.h"
#include "StdPriceMst.h"
using namespace FAP;
void StdPriceMst::InitGrid(int iLanguage){
DataGridTextBoxColumn *oCode;
DataGridTextBoxColumn *oName;
DataGridTextBoxColumn *oPrice1;
DataGridTextBoxColumn *oPrice2;
DataGridTextBoxColumn *oPrice;
DataGridTextBoxColumn *oSerials;
DataGridTableStyle* oTableStyle;
oTableStyle = new DataGridTableStyle();
oTableStyle->MappingName = S"StdPrice";
//oCode
oCode = new DataGridTextBoxColumn();
oCode->MappingName = S"PRODUCT_CODE";
oCode->HeaderText = infPrice->saSAPPRODUCT_CODE[iLanguage];
oCode->Alignment = HorizontalAlignment::Left;
oCode->Width = 100;
oCode->NullText = S"";
oCode->ReadOnly =true;
//oName
oName = new DataGridTextBoxColumn();
oName->MappingName = S"Name";
oName->HeaderText = infPrice->sa_Name[iLanguage];
oName->Alignment = HorizontalAlignment::Left;
oName->Width = 200 ;
oName->NullText = S"";
oName->ReadOnly =true;
//oPrice1
oPrice1 = new DataGridTextBoxColumn();
oPrice1->MappingName = S"PRICE1_RMB";
oPrice1->HeaderText = infPrice->sa_Price1[iLanguage];
oPrice1->Alignment = HorizontalAlignment::Right;
oPrice1->Width = 100;
oPrice1->NullText = S"";
oPrice1->ReadOnly =false;
//oPrice2
oPrice2 = new DataGridTextBoxColumn();
oPrice2->MappingName = S"PRICE2_RMB";
oPrice2->HeaderText = infPrice->sa_Price2[iLanguage];
oPrice2->Alignment = HorizontalAlignment::Center;
oPrice2->Width = 100;
oPrice2->NullText = S"";
oPrice2->ReadOnly =false;
//oPrice
oPrice = new DataGridTextBoxColumn();
oPrice->MappingName = S"RMB";
oPrice->HeaderText = infPrice->sa_Price[iLanguage];
oPrice->Alignment = HorizontalAlignment::Center;
oPrice->Width = 100;
oPrice->NullText = S"";
oPrice->ReadOnly =false;
//oSerials
oSerials = new DataGridTextBoxColumn();
oSerials->MappingName = S"SERIES";
oSerials->HeaderText = infPrice->sa_Serial[iLanguage];
oSerials->Alignment = HorizontalAlignment::Center;
oSerials->Width = 100;
oSerials->NullText = S"";
oSerials->ReadOnly =true;
oTableStyle->GridColumnStyles->Add(oCode);
oTableStyle->GridColumnStyles->Add(oName);
oTableStyle->GridColumnStyles->Add(oPrice1);
oTableStyle->GridColumnStyles->Add(oPrice2);
oTableStyle->GridColumnStyles->Add(oPrice);
oTableStyle->GridColumnStyles->Add(oSerials);
dGridStock->TableStyles->Add(oTableStyle);
}
void StdPriceMst::GetGrid(int intLang){
String *strSQL;
String * strArray[] = {S"C",S"J",S"E"};
DataSet *dsetTmp ;
DataView *dViewTmp;
DataTable *dTblTmp;
strSQL = S"select distinct a.PRODUCT_CODE,a.parts_name_";
strSQL = String::Concat( strSQL,strArray[intLang]);
strSQL = String::Concat( strSQL,S" as Name, b.PRICE1_RMB,b.PRICE2_RMB,b.RMB,b.SERIES");
strSQL = String::Concat( strSQL,S" from parts_mst a join SALE_PRICE_MST b ");
strSQL = String::Concat( strSQL,S" on a.product_code = b.product_code ");
dsetTmp = dbPrice->dSetSQL_Select(strSQL,S"StdPrice",0);
dTblTmp = dsetTmp->Tables->Item[S"StdPrice"];
dViewTmp = new DataView(dTblTmp);
dViewTmp->AllowDelete = false;
dViewTmp->AllowNew = false;
dGridStock->DataSource = dViewTmp;
//数组大小
intCount = __try_cast<DataView *>(dGridStock->DataSource)->Count;
intArray = __gc new Int32[intCount] ;
}
bool StdPriceMst::UpdateGrid(){
String * strSQL;
Single sngPrice1;
Single sngPrice;
Single sngPrice2;
String *strCode;
String *strSerial;
DataGridCell dCellPrice1 ;
DataGridCell dCellPrice2;
DataGridCell dCellPrice;
DataGridCell dCellCode;
DataGridCell dCellSerial;
dCellPrice.ColumnNumber = 4;
dCellPrice1.ColumnNumber = 2;
dCellPrice2.ColumnNumber = 3;
dCellCode.ColumnNumber = 0;
dCellSerial.ColumnNumber = 5;
for (int i = 0; i< intCount;i++) {
if (0 == intArray[i]){
continue;
}
dCellCode.RowNumber = i;
dCellSerial.RowNumber = i;
dCellPrice.RowNumber = i;
dCellPrice1.RowNumber = i;
dCellPrice2.RowNumber = i;
try{
sngPrice1 = Single::Parse(dGridStock->Item[dCellPrice1]->ToString());
sngPrice = Single::Parse(dGridStock->Item[dCellPrice]->ToString());
sngPrice2 = Single::Parse(dGridStock->Item[dCellPrice2]->ToString());
}
catch (...) {
MessageBox::Show(S"请输入数字!");
return false;
}
strCode = dGridStock->Item[dCellCode]->ToString();
strSerial = dGridStock->Item[dCellSerial]->ToString();
strSQL = S"update SALE_PRICE_MST set PRICE1_RMB =";
strSQL = String::Concat( strSQL,sngPrice1.ToString(),S",");
strSQL = String::Concat( strSQL, S"PRICE2_RMB = ", sngPrice2.ToString(),S",");
strSQL = String::Concat( strSQL, S"RMB = ", sngPrice.ToString());
strSQL = String::Concat(strSQL,S" where PRODUCT_CODE = '",strCode,S"'");
strSQL = String::Concat(strSQL,S" and SERIES = '",strSerial,S"'");
//MessageBox::Show(strSQL);
if (!dbPrice->blnSQL_Execute(strSQL)){
//MessageBox::Show(S"更新失败!");
return false;
}
}
return true;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -