You are on page 1of 5

CODIGO // CARDILView.cpp : implementation of the CCARDILView class // #include "stdafx.h" #include "CARDIL.h" #include "CARDILDoc.h" #include "CARDILView.

h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////// //////////////////////////////// // CCARDILView IMPLEMENT_DYNCREATE(CCARDILView, CFormView) BEGIN_MESSAGE_MAP(CCARDILView, CFormView) //{{AFX_MSG_MAP(CCARDILView) ON_BN_CLICKED(IDC_CANCELAR, OnCancelar) ON_BN_CLICKED(IDC_RADIO1, OnRadio1) ON_LBN_SELCHANGE(IDC_LIST1, OnSelchangeList1) ON_BN_CLICKED(IDC_ACEPTAR, OnAceptar) ON_BN_CLICKED(IDC_PRECIOT, OnPreciot) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////// //////////////////////////////// // CCARDILView construction/destruction CCARDILView::CCARDILView() : CFormView(CCARDILView::IDD) { //{{AFX_DATA_INIT(CCARDILView) m_datos = _T(""); m_preciototal = 0.0; m_dni = _T(""); m_prCaja = 0.0; m_prDocena = 0.0; m_radio = -1; m_cantidad = _T(""); m_dirnombre = _T(""); m_dirnum = _T(""); m_dirdist = _T(""); //}}AFX_DATA_INIT // TODO: add construction code here } CCARDILView::~CCARDILView() { }

void CCARDILView::DoDataExchange(CDataExch ange* pDX) { CFormView::DoDataExchange(pDX) ; //{{AFX_DATA_MAP(CCARDILView) DDX_Control(pDX, IDC_DIRLUGAR, m_dirlugar); DDX_Control(pDX, IDC_UNI, m_unidad); DDX_Control(pDX, IDC_LIST1, m_lista); DDX_Text(pDX, IDC_DATOS, m_datos); DDX_Text(pDX, IDC_PRECIOTOTAL, m_preciototal); DDX_Text(pDX, IDC_DNI, m_dni); DDX_Text(pDX, IDC_CAJA, m_prCaja); DDX_Text(pDX, IDC_DOC, m_prDocena); DDX_Radio(pDX, IDC_RADIO1, m_radio); DDX_Text(pDX, IDC_CAN, m_cantidad); DDX_Text(pDX, IDC_DIRNOMBRE, m_dirnombre); DDX_Text(pDX, IDC_DIRNUM, m_dirnum); DDX_Text(pDX, IDC_DIRDIST, m_dirdist); //}}AFX_DATA_MAP } BOOL CCARDILView::PreCreateWindow(CREATES TRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CFormView::PreCreateWindow(cs); } ///////////////////////////////////////////// /////// void CCARDILView::OnInitialUpdate() {

CFormView::OnInitialUpdate(); GetParentFrame()->RecalcLayout(); ResizeParentToFit(); m_lista.AddString("Coca Cola"); m_lista.AddString("Inca Kola"); m_lista.AddString("Pepsi"); m_lista.AddString("Sprite"); } ///////////////////////////////////////////// //////////////////////////////// // CCARDILView diagnostics #ifdef _DEBUG void CCARDILView::AssertValid() const { CFormView::AssertValid(); } void CCARDILView::Dump(CDumpContext& dc) const { CFormView::Dump(dc); } CCARDILDoc* CCARDILView::GetDocument() // nondebug version is inline { ASSERT(m_pDocument>IsKindOf(RUNTIME_CLASS(CCARDILDoc))); return (CCARDILDoc*)m_pDocument; } #endif //_DEBUG ///////////////////////////////////////////// //////////////////////////////// // CCARDILView message handlers void CCARDILView::OnCancelar() { // TODO: Add your control notification handler code here if (MessageBox(" Desea salir ?","Salir",MB_ICONQUESTION+MB_YESNO) ==IDYES) PostQuitMessage(0); }

///////////////////////////////////////////// ///////////// void CCARDILView::OnRadio1() { // TODO: Add your control notification handler code here } ///////////////////////////////////////////// ////////// void CCARDILView::OnSelchangeList1() { // TODO: Add your control notification handler code here double n; CString strTexto,texto; m_lista.GetText (m_lista.GetCurSel (), strTexto); texto="Usted a elegido nuestro producto"+strTexto;

void CCARDILView::OnAceptar() { // TODO: Add your control notification handler code here CString mensaje,dni,pedido,lugar; UpdateData(true); m_unidad.GetLBText(m_unidad.GetCurSel( ),pedido); m_dirlugar.GetLBText(m_dirlugar.GetCurS el(),lugar); mensaje="Seor(a) "+m_datos+",con DNI N"+m_dni+" su pedido es "+m_cantidad+pedido+" que sera entregado en la direccion: "+lugar+""+m_dirnombre+" N "+m_dirnum+""+m_dirdist;

if(m_radio==0) {n=10;} else {n=12;} MessageBox(texto,"PRODUCTO",MB_ICON INFORMATION); UpdateData(true); if(strTexto=="Coca Cola") {m_prDocena=1.16*n;m_prCaja=13.4*n;} if(strTexto=="Inca Kola") {m_prDocena=1.125*n;m_prCaja=13.2*n;} if(strTexto=="Pepsi") {m_prDocena=1.11*n;m_prCaja=13*n;} if(strTexto=="Sprite") {m_prDocena=1.05*n;m_prCaja=12.8*n;}

MessageBox(mensaje,"PEDIDO",MB_ICONI NFORMATION); UpdateData(false); //MessageBox("Debe de llenar todo los datos","NECESARIO",MB_ICONINFORMATI ON); } ///////////////////////////////////////////// /////////// void CCARDILView::OnPreciot() { // TODO: Add your control notification handler code here double cantidad; CString precio; UpdateData(true); cantidad=atof(m_cantidad); m_unidad.GetLBText(m_unidad.GetCurSel( ),precio);

if(precio=="caja") m_preciototal=cantidad*m_prDocena; UpdateData(false); } ///////////////////////////////////////////// ////////// else m_preciototal=cantidad*m_prCaja

; UpdateData(false); } /////////////////////////////////////

You might also like