Ejemplo n.º 1
0
        // --- obtener la ultima version de la cotización
        public BindingList <PriceMethodHistory> GetPriceMethodHistory(CPrice_version price_version, int?idtemplate_method)
        {
            var query =
                (from m in new CPrice_version_detailFactory().GetAll()
                 join n in new CPrice_versionFactory().GetAll() on m.Idprice_version equals n.Idprice_version
                 select m).ToList();

            List <PriceMethodHistory> lst =
                (from m in new CPrice_version_detailFactory().GetAll()
                 join n in new CPrice_versionFactory().GetAll() on m.Idprice_version equals n.Idprice_version into tmp1
                 from o in tmp1
                 join p in new CPriceFactory().GetAll() on o.Idprice equals p.Idprice
                 where o.Idcompany == price_version.Idcompany && m.Idtemplate_method == idtemplate_method &&
                 o.Idprice_version != price_version.Idprice_version &&
                 o.Date_creation < price_version.Date_creation
                 select new PriceMethodHistory
            {
                Name = "History",
                Idprice_version = m.Idprice_version,
                Cod_price = p.Cod_price,
                Num_version = o.Num_version,
                Date_creation = o.Date_creation,
                Amount_item = m.Amount_item,
                Unit_price = m.Unit_price
            }).OrderByDescending(c => c.Cod_price).ToList();

            return(new BindingList <PriceMethodHistory>(lst));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// update row in the table
        /// </summary>
        /// <param name="businessObject">business object</param>
        /// <returns>true for successfully updated</returns>
        public bool Update(CPrice_version businessObject)
        {
            NpgsqlCommand sqlCommand = new NpgsqlCommand();

            sqlCommand.CommandText = "public.sp_price_version_Update";
            sqlCommand.CommandType = CommandType.StoredProcedure;

            // Use connection object of base class
            sqlCommand.Connection = MainConnection;

            try
            {
                sqlCommand.Parameters.AddWithValue("p_idprice_version", businessObject.Idprice_version);
                sqlCommand.Parameters["p_idprice_version"].NpgsqlDbType = NpgsqlDbType.Integer;
                sqlCommand.Parameters.AddWithValue("p_idprice", businessObject.Idprice);
                sqlCommand.Parameters["p_idprice"].NpgsqlDbType = NpgsqlDbType.Integer;
                sqlCommand.Parameters.AddWithValue("p_idrecep_sample", businessObject.Idrecep_sample);
                sqlCommand.Parameters["p_idrecep_sample"].NpgsqlDbType = NpgsqlDbType.Bigint;
                sqlCommand.Parameters.AddWithValue("p_num_version", businessObject.Num_version);
                sqlCommand.Parameters["p_num_version"].NpgsqlDbType = NpgsqlDbType.Integer;
                sqlCommand.Parameters.AddWithValue("p_cod_type_sample", businessObject.Cod_type_sample);
                sqlCommand.Parameters["p_cod_type_sample"].NpgsqlDbType = NpgsqlDbType.Varchar;
                sqlCommand.Parameters.AddWithValue("p_idcompany", businessObject.Idcompany);
                sqlCommand.Parameters["p_idcompany"].NpgsqlDbType = NpgsqlDbType.Smallint;
                sqlCommand.Parameters.AddWithValue("p_attention", businessObject.Attention);
                sqlCommand.Parameters["p_attention"].NpgsqlDbType = NpgsqlDbType.Smallint;
                sqlCommand.Parameters.AddWithValue("p_iduser", businessObject.Iduser);
                sqlCommand.Parameters["p_iduser"].NpgsqlDbType = NpgsqlDbType.Smallint;
                sqlCommand.Parameters.AddWithValue("p_num_days_post", businessObject.Num_days_post);
                sqlCommand.Parameters["p_num_days_post"].NpgsqlDbType = NpgsqlDbType.Integer;
                sqlCommand.Parameters.AddWithValue("p_date_creation", businessObject.Date_creation);
                sqlCommand.Parameters["p_date_creation"].NpgsqlDbType = NpgsqlDbType.Timestamp;
                sqlCommand.Parameters.AddWithValue("p_user_creation", businessObject.User_creation);
                sqlCommand.Parameters["p_user_creation"].NpgsqlDbType = NpgsqlDbType.Varchar;
                sqlCommand.Parameters.AddWithValue("p_num_days_valid", businessObject.Num_days_valid);
                sqlCommand.Parameters["p_num_days_valid"].NpgsqlDbType = NpgsqlDbType.Smallint;
                sqlCommand.Parameters.AddWithValue("p_status_price", businessObject.Status_price);
                sqlCommand.Parameters["p_status_price"].NpgsqlDbType = NpgsqlDbType.Integer;
                sqlCommand.Parameters.AddWithValue("p_observation", businessObject.Observation);
                sqlCommand.Parameters["p_observation"].NpgsqlDbType = NpgsqlDbType.Varchar;


                MainConnection.Open();

                if (Convert.ToInt32(sqlCommand.ExecuteScalar()) > 0)
                {
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                throw new Exception("CPrice_version::Update::Error occured.", ex);
            }
            finally
            {
                MainConnection.Close();
                sqlCommand.Dispose();
            }
        }
Ejemplo n.º 3
0
        public List <Anexos> GetLstAnexos(CPrice_version price_version)
        {
            if (price_version == null)
            {
                List <Anexos> lst = new List <Anexos>();
                return(lst);
            }
            else
            {
                var query =
                    new CPrice_attachFactory()
                    .GetAll()
                    .Where(c =>
                           c.Idprice == price_version.Idprice
                           ).ToList();

                List <Anexos> query2 =
                    (from m in query
                     from n in new CPrice_versionFactory().GetAll().Where(c => c.Idprice == m.Idprice && c.Idprice_version == m.Idprice_version).DefaultIfEmpty()
                     where n.Num_version <= price_version.Num_version
                     select new Anexos
                {
                    Filename = m.Name_document,
                    Idprice = m.Idprice,
                    Idprice_version = m.Idprice_version,
                    Num_version = n.Num_version,
                    Source_filename = ""
                }).ToList();

                return(query2);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Populate business objects from the data reader
        /// </summary>
        /// <param name="dataReader">data reader</param>
        /// <returns>list of CPrice_version</returns>
        internal List <CPrice_version> PopulateObjectsFromReader(IDataReader dataReader)
        {
            List <CPrice_version> list = new List <CPrice_version>();

            while (dataReader.Read())
            {
                CPrice_version businessObject = new CPrice_version();
                PopulateBusinessObjectFromReader(businessObject, dataReader);
                list.Add(businessObject);
            }
            return(list);
        }
Ejemplo n.º 5
0
        public FormPrice(CPrice_version pPrice_version, LoadData pLoadData)
        {
            InitializeComponent();

            Init();

            oPrice_version = pPrice_version;
            loadData       = pLoadData;

            if (pPrice_version != null)
            {
                oPrice = new CPriceFactory().GetByPrimaryKey(new CPriceKeys(Convert.ToInt32(oPrice_version.Idprice)));
            }

            Recuperar_Registro();

            ShowStatusControl();
        }
Ejemplo n.º 6
0
        protected override void Limpiar_Campos()
        {
            oPrice                  = null;
            oPrice_version          = null;
            LstPrice_version_detail = null;
            totalAmount             = 0;

            cbTypeSample.EditValue  = null;
            cbCompany.EditValue     = null;
            deDateCreation.DateTime = Comun.GetDate();
            tbNumDaysValid.Value    = new CSettings().GetNumDaysPriceDefault();

            tbClientDomicile.Text       = "";
            tbClientPhone.Text          = "";
            tbClientRuc.Text            = "";
            tabHead.Text                = "Datos";
            tbCodPrice.Text             = "";
            tbNumVersion.Text           = "";
            ckDispatchCurier.Checked    = false;
            ckDispatchFax.Checked       = false;
            ckDispatchPerson.Checked    = false;
            ckDispatchTransport.Checked = false;
            ckSaveHistoryEnd.Checked    = false;
            ckSaveHistoryIni.Checked    = false;
            tbObservation.Text          = "";

            tbSubTotalAmount.Value = 0;
            tbTotalAmount.Value    = 0;
            tbTotalIgv.Value       = 0;

            gcPrice.DataSource   = new BindingList <PriceMethod>(new ModPrice().GetPriceMethod(null));
            gcContact.DataSource = null;

            richTextIni.RichTextBox.Clear();
            richTextEnd.RichTextBox.Clear();

            gcAnexos.DataSource = new BindingList <Anexos>(new ModPrice().GetLstAnexos(null));

            previewControl1.Clear();

            loadData = LoadData.Nothing;

            ShowStatusControl();
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Select by primary key
        /// </summary>
        /// <param name="keys">primary keys</param>
        /// <returns>CPrice_version business object</returns>
        public CPrice_version SelectByPrimaryKey(CPrice_versionKeys keys)
        {
            NpgsqlCommand sqlCommand = new NpgsqlCommand();

            sqlCommand.CommandText = "public.sp_price_version_SelectByPrimaryKey";
            sqlCommand.CommandType = CommandType.StoredProcedure;

            // Use connection object of base class
            sqlCommand.Connection = MainConnection;

            try
            {
                sqlCommand.Parameters.Add(new NpgsqlParameter("p_idprice_version", NpgsqlDbType.Integer, 4, "", ParameterDirection.Input, false, 0, 0, DataRowVersion.Proposed, keys.Idprice_version));


                MainConnection.Open();

                NpgsqlDataReader dataReader = sqlCommand.ExecuteReader();

                if (dataReader.Read())
                {
                    CPrice_version businessObject = new CPrice_version();

                    PopulateBusinessObjectFromReader(businessObject, dataReader);

                    return(businessObject);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("CPrice_version::SelectByPrimaryKey::Error occured.", ex);
            }
            finally
            {
                MainConnection.Close();
                sqlCommand.Dispose();
            }
        }
Ejemplo n.º 8
0
        public void Save(CPrice price, CPrice_version price_version)
        {
            foreach (CItemCopy item in this)
            {
                //copiar item
                if (ComunForm.CopyAndSaveFile(item.Source_file, item.Destiny_directory, item.Filename))
                {
                    CPrice_attach price_attach = new CPrice_attach();
                    price_attach.Idprice         = price_version.Idprice;
                    price_attach.Idprice_version = price_version.Idprice_version;
                    price_attach.Name_document   = item.Filename;

                    //guardar adjunto
                    if (!new CPrice_attachFactory().Update(price_attach))
                    {
                        new CPrice_attachFactory().Insert(price_attach);
                    }
                }
            }
        }
Ejemplo n.º 9
0
        public List <PriceMethod> GetPriceMethod(CPrice_version price_version)
        {
            if (price_version == null)
            {
                List <PriceMethod> lstPriceMethod = new List <PriceMethod>();
                return(lstPriceMethod);
            }
            else
            {
                List <CPrice_version_detail> lst =
                    (from m in new CPrice_version_detailFactory().GetAll()
                     where m.Idprice_version == price_version.Idprice_version
                     select m).ToList();

                List <PriceMethod> lstPriceMethod = new List <PriceMethod>();
                foreach (CPrice_version_detail item in lst)
                {
                    lstPriceMethod.Add(new PriceMethod(item, GetPriceMethodHistory(price_version, item.Idtemplate_method)));
                }
                return(lstPriceMethod);
            }
        }
Ejemplo n.º 10
0
        private void ucToolButtons_onFind()
        {
            // ---
            FormMasterSearch fmBusqueda = new FormMasterSearch();
            UcFilterPrice    filter     = new UcFilterPrice();

            filter.onSearch += delegate(ModMasterSearch.KeyFilterPrice key)
            {
                fmBusqueda.BindGrid(new ModMasterSearch().GetPrices(key));
            };

            fmBusqueda.BindGrid(filter, filter.Size, new ModMasterSearch().GetPrices(filter.keyDefault));
            fmBusqueda.ShowDialog();

            Dictionary <string, string> keys = fmBusqueda.getKeyValues();

            if (keys != null)
            {
                Limpiar_Campos();

                loadData = LoadData.MasterSearchPrice;

                /// recuperar cotización seleccionada
                oPrice_version =
                    new CPrice_versionFactory()
                    .GetByPrimaryKey(new CPrice_versionKeys(Convert.ToInt32(keys["Idprice_version"])));

                oPrice =
                    new CPriceFactory()
                    .GetByPrimaryKey(new CPriceKeys(Convert.ToInt32(oPrice_version.Idprice)));

                Recuperar_Registro();

                ShowStatusControl();
            }
        }
Ejemplo n.º 11
0
        private void btAdd_Click(object sender, EventArgs e)
        {
            if (cbCompany.EditValue != null && cbMethodAdd.EditValue != null)
            {
                BindingList <PriceMethod> lst = gcPrice.DataSource as BindingList <PriceMethod>;
                List <PriceMethod>        myLstPriceMethod = lst.ToList();

                // agregar un método a la lista
                int idtemplate_method             = Convert.ToInt32(cbMethodAdd.EditValue);
                CTemplate_method oTemplate_method = new CTemplate_methodFactory().GetByPrimaryKey(new CTemplate_methodKeys(idtemplate_method));

                CPrice_version price_version = new CPrice_version();
                price_version.Idprice_version = 0;
                price_version.Idcompany       = Convert.ToInt16(cbCompany.EditValue);
                price_version.Date_creation   = Comun.GetDate();

                CPrice_version_detail price_version_detail = new CPrice_version_detail();
                price_version_detail.Num_item          = myLstPriceMethod.Count + 1;
                price_version_detail.Amount_item       = 1;
                price_version_detail.Idtemplate_method = idtemplate_method;
                price_version_detail.Unit_price        = oTemplate_method.Cost_method;
                price_version_detail.Sale_price        = oTemplate_method.Cost_method * price_version_detail.Amount_item;

                myLstPriceMethod.Add(
                    new PriceMethod(price_version_detail, new ModPrice().GetPriceMethodHistory(price_version, price_version_detail.Idtemplate_method)));

                gcPrice.DataSource = new BindingList <PriceMethod>(myLstPriceMethod);
                gvPrice.LayoutChanged();

                cbMethodAdd.EditValue = null;

                SumTotals();

                ShowPreviewReport();
            }
        }
Ejemplo n.º 12
0
        protected override bool Grabar_Registro()
        {
            // --- save company
            bool result_company = false;

            CCompany oCompany = new CCompany();

            if (cbCompany.EditValue != null)
            {
                CCorr_modulesFactory faCorr_modules = new CCorr_modulesFactory();
                CCompanyFactory      faCompany      = new CCompanyFactory();

                oCompany.Idcompany = Convert.ToInt16(cbCompany.EditValue);
                //oCompany.Cod_company =  faCorr_modules.GetCorrModule(Comun.Formulario.fmEmpresa.ToString());
                oCompany.Ruc           = tbClientRuc.Text;
                oCompany.Business_name = cbCompany.Text;
                oCompany.Domicile      = tbClientDomicile.Text;
                oCompany.Type_company  = 'C'; // --- client
                oCompany.Phone_client  = tbClientPhone.Text;

                if (!(result_company = faCompany.Update(oCompany)))
                {
                    result_company = faCompany.Insert(oCompany);
                }
            }

            bool result_price = false;

            if (oPrice == null)
            {
                oPrice = new CPrice();
            }

            CPriceFactory faPrice = new CPriceFactory();

            if (!(loadData == LoadData.FromPrice_ToNewVersion))
            {
                oPrice.Cod_price = new ModCorrelatives().GetCorrelative(Comun.Correlative.Price);
            }

            // --- person
            if (ckDispatchPerson.Checked)
            {
                oPrice.Dispatch_person = 1;
            }
            else
            {
                oPrice.Dispatch_person = 0;
            }
            // --- curier
            if (ckDispatchCurier.Checked)
            {
                oPrice.Dispatch_curier = 1;
            }
            else
            {
                oPrice.Dispatch_curier = 0;
            }
            // --- transport
            if (ckDispatchTransport.Checked)
            {
                oPrice.Dispatch_transport = 1;
            }
            else
            {
                oPrice.Dispatch_transport = 0;
            }
            // --- fax
            if (ckDispatchFax.Checked)
            {
                oPrice.Dispatch_fax = 1;
            }
            else
            {
                oPrice.Dispatch_fax = 0;
            }

            if (!(result_price = faPrice.Update(oPrice)))
            {
                result_price = faPrice.Insert(oPrice);
            }

            // --- save contacts
            CPerson                      oContact = new CPerson();
            CPersonFactory               faPerson = new CPersonFactory();
            CPrice_company_person        oPrice_company_person  = new CPrice_company_person();
            CPrice_company_personFactory faPrice_company_person = new CPrice_company_personFactory();

            // --- delete all
            if (result_price)
            {
                oPrice_version = new CPrice_version();
                CPrice_versionFactory faPrice_version = new CPrice_versionFactory();

                oPrice_version.Idprice = oPrice.Idprice;

                oPrice_version.Idcompany = null;
                if (cbCompany.EditValue != null)
                {
                    oPrice_version.Idcompany = Convert.ToInt16(cbCompany.EditValue);
                }

                oPrice_version.Cod_type_sample = cbTypeSample.EditValue.ToString();
                oPrice_version.Num_version     = new ModPrice().GetNextNumVersion(oPrice.Idprice);
                oPrice_version.Date_creation   = deDateCreation.DateTime;
                oPrice_version.Num_days_valid  = Convert.ToInt16(tbNumDaysValid.Value);

                oPrice_version.Observation = tbObservation.Text;

                oPrice_version.Iduser       = Comun.User_system.Iduser;
                oPrice_version.Status_price = 1;

                bool result_price_version = false;
                if (!(result_price_version = faPrice_version.Update(oPrice_version)))
                {
                    result_price_version = faPrice_version.Insert(oPrice_version);
                }

                if (result_price_version)
                {
                    //guardar párrafos iniciales
                    CMemo_price        oMemoPrice;
                    CMemo_priceFactory faMemo_price = new CMemo_priceFactory();

                    //guardando el parrafo inicial
                    oMemoPrice = new CMemo_price();
                    oMemoPrice.Idprice_version = oPrice_version.Idprice_version;
                    oMemoPrice.Paragraph       = richTextIni.RichTextBox.Rtf;
                    oMemoPrice.Memo_type       = 1;
                    faMemo_price.Insert(oMemoPrice);

                    //guardando el parrafo final
                    oMemoPrice = new CMemo_price();
                    oMemoPrice.Idprice_version = oPrice_version.Idprice_version;
                    oMemoPrice.Paragraph       = richTextEnd.RichTextBox.Rtf;
                    oMemoPrice.Memo_type       = 2;
                    faMemo_price.Insert(oMemoPrice);

                    if (ckSaveHistoryIni.Checked)
                    {
                        CMemo_template        oMemo_template  = new CMemo_template();
                        CMemo_templateFactory faMemo_template = new CMemo_templateFactory();

                        oMemo_template.Paragraph     = richTextIni.RichTextBox.Text;
                        oMemo_template.Paragraph_rtf = richTextIni.RichTextBox.Rtf.ToString();
                        oMemo_template.Memo_type     = 1;
                        faMemo_template.Insert(oMemo_template);
                    }

                    //guardar párrafos finales
                    if (ckSaveHistoryEnd.Checked)
                    {
                        CMemo_template        oMemo_template  = new CMemo_template();
                        CMemo_templateFactory faMemo_template = new CMemo_templateFactory();

                        oMemo_template.Paragraph_rtf = richTextEnd.RichTextBox.Rtf;
                        oMemo_template.Paragraph     = richTextEnd.RichTextBox.Text.ToString();
                        oMemo_template.Memo_type     = 2;
                        faMemo_template.Insert(oMemo_template);
                    }
                }

                if (result_price)
                {
                    CCompany_person        oCompany_person  = new CCompany_person();
                    CCompany_personFactory faCompany_person = new CCompany_personFactory();

                    for (int i = 0; i < gvContact.RowCount; i++)
                    {
                        oContact.Idperson  = Convert.ToInt16(gvContact.GetRowCellValue(i, gcCon_Idperson));
                        oContact.Phone     = gvContact.GetRowCellValue(i, gcCon_Phone).ToString();
                        oContact.Cellphone = gvContact.GetRowCellValue(i, gcCon_Cellphone).ToString();
                        oContact.Mail      = gvContact.GetRowCellValue(i, gcCon_Mail).ToString();
                        oContact.Allname   = gvContact.GetRowCellValue(i, gcCon_Allname).ToString();

                        bool result_contact = false;
                        if (!(result_contact = faPerson.Update(oContact)))
                        {
                            result_contact = faPerson.Insert(oContact);
                        }

                        if (result_contact)
                        {
                            oPrice_company_person = new CPrice_company_person();

                            oPrice_company_person.Idprice_company_person = 0;
                            oPrice_company_person.Idcompany       = oCompany.Idcompany;
                            oPrice_company_person.Idprice         = oPrice.Idprice;
                            oPrice_company_person.Idperson        = oContact.Idperson;
                            oPrice_company_person.Idprice_version = oPrice_version.Idprice_version;
                            oPrice_company_person.Person_type     = Convert.ToInt16(gvContact.GetRowCellValue(i, gcCon_Person_type));

                            if (!faPrice_company_person.Update(oPrice_company_person))
                            {
                                faPrice_company_person.Insert(oPrice_company_person);
                            }
                        }

                        // --- save history company person
                        if (!faCompany_person.GetAll().Exists(c => c.Idcompany == oCompany.Idcompany && c.Idperson == oContact.Idperson))
                        {
                            oCompany_person           = new CCompany_person();
                            oCompany_person.Idcompany = oCompany.Idcompany;
                            oCompany_person.Idperson  = oContact.Idperson;

                            if (!faCompany_person.Update(oCompany_person))
                            {
                                faCompany_person.Insert(oCompany_person);
                            }
                        }
                    }
                }

                if (result_price_version)
                {
                    // guardar detalle
                    CPrice_version_detail        oPrice_version_detail  = new CPrice_version_detail();
                    CPrice_version_detailFactory faPrice_version_detail = new CPrice_version_detailFactory();

                    for (int i = 0; i < gvPrice.RowCount; i++)
                    {
                        oPrice_version_detail = new CPrice_version_detail();
                        oPrice_version_detail.Idprice_version   = oPrice_version.Idprice_version;
                        oPrice_version_detail.Idtemplate_method = Convert.ToInt32(gvPrice.GetRowCellValue(i, gcolItem_Idtemplate_method));
                        oPrice_version_detail.Num_item          = Convert.ToInt32(gvPrice.GetRowCellValue(i, gcolItem_Num_item));
                        oPrice_version_detail.Amount_item       = Convert.ToInt32(gvPrice.GetRowCellValue(i, gcolItem_Amount_item));
                        oPrice_version_detail.Sale_price        = Convert.ToDecimal(gvPrice.GetRowCellValue(i, gcolItem_Sale_price));
                        oPrice_version_detail.Unit_price        = Convert.ToDecimal(gvPrice.GetRowCellValue(i, gcolItem_Unit_price));

                        if (!faPrice_version_detail.Update(oPrice_version_detail))
                        {
                            faPrice_version_detail.Insert(oPrice_version_detail);
                        }
                    }
                }

                if (result_price_version)
                {
                    if (gvAnexos.RowCount > 0)
                    {
                        // guardar adjuntos
                        ListCopy lstCopySave = new ListCopy();

                        List <Anexos> lstAnexos = (gcAnexos.DataSource as BindingList <Anexos>).ToList();

                        if (lstAnexos != null && lstAnexos.Count > 0)
                        {
                            foreach (Anexos item in lstAnexos)
                            {
                                if (item.Source_filename.Trim().Length > 0)
                                {
                                    string destiny_directory = oSettings.GetPathAttachPrice();

                                    lstCopySave.Add(
                                        new CItemCopy()
                                    {
                                        Filename          = item.Filename,
                                        Source_file       = item.Source_filename,
                                        Destiny_directory = destiny_directory
                                    });
                                }
                            }

                            lstCopySave.Save(oPrice, oPrice_version);
                        }
                    }
                }
            }

            return(true);
        }
Ejemplo n.º 13
0
 public CRecep_sample getRecep_sample(CPrice_version p_price_version)
 {
     return(new CRecep_sampleFactory()
            .GetByPrimaryKey(new CRecep_sampleKeys(Convert.ToInt64(p_price_version.Idrecep_sample))));
 }
Ejemplo n.º 14
0
 public DataTable GetDTPrice_version_detail(CPrice_version price_version)
 {
     return(ToDataTable <PriceMethod>(GetPriceMethod(price_version)));
 }
Ejemplo n.º 15
0
        protected override void Limpiar_Campos()
        {
            txIdrecep_sample.Text = "";
            IDCompany = 0;
            cbCompany.EditValue = null;
            tbClientRuc.Text = "";
            tbClientDomicile.Text = "";
            tbClientPhone.Text = "";
            ckDispatchPerson.Checked = false;
            ckDispatchCurier.Checked = false;
            ckDispatchTransport.Checked = false;
            ckDispatchFax.Checked = false;
            tbSubTotalAmount.Text = "";
            tbTotalIgv.Text = "";
            tbTotalAmount.Text = "";
            totalAmount = 0;
            tbAmortization.Text = "";
            tbResidue.Text = "";
            deReception.DateTime = DateTime.Now;
            deHourReception.EditValue = DateTime.Now;
            deResult.Text = "";
            deHourResult.Text = "";
            tbCod_recep_sample.Text = "";

            deHourResult.Time = DateTime.Now;
            tbNumDays.Value = 0;
            deResult.EditValue = null;
            deHourResult.EditValue = null;

            tpRightReports.PageVisible = false;
            tpRightAttach.PageVisible = false;
            tpRightProgram.PageVisible = false;

            lstItemsSelAttach.Clear();
            lstItemsSelReport.Clear();
            lstItemsSelProgram.Clear();

            InitDatatable();
            InitDataControls();

            gcContact.DataSource = null;
            gcReport.DataSource = null;
            gcAttachFile.DataSource = null;
            gcProgram.DataSource = null;
            ClearElemColumns();

            ucSignReception.Clear();

            oRecep_sample = null;
            oPrice = null;
            oPrice_version = null;
        }
Ejemplo n.º 16
0
        /// <summary>
        /// inicializa un nuevo registro de recepción desde una cotización
        /// </summary>
        /// <param name="pPrice_version"></param>
        public FormReception(CPrice_version pPrice_version, LoadData generic)
        {
            InitializeComponent();

            loadData = generic;

            Init();

            Recuperar_Registro();

            ChangeStatusControls();

            statusRegReception = StatusRegRecep.reg_recep_saved;
        }
Ejemplo n.º 17
0
        void OpenFormMasterSearch(typeModule tm)
        {
            if (tm == typeModule.RegisterReception)
            {
                ///attributes
                short? p_year = null;
                short? p_idcompany = null;
                DateTime? p_date_begin = null;
                DateTime? p_date_end = null;

                FormMasterSearch fmBusqueda = new FormMasterSearch();
                fmBusqueda.BindGrid(new ModMasterSearch().GetRegReception(p_year, p_idcompany, p_date_begin, p_date_end));

                fmBusqueda.ShowDialog();

                Dictionary<string, string> keys = fmBusqueda.getKeyValues();

                if (keys != null)
                {
                    ///get recep sample
                    oRecep_sample = faRecep_sample.GetByPrimaryKey(new CRecep_sampleKeys(Convert.ToInt64(keys["Idrecep_sample"])));
                    oPrice_version = faPrice_version.GetByPrimaryKey(new CPrice_versionKeys(Convert.ToInt32(keys["Idprice_version"])));
                    Limpiar_Campos();
                    Recuperar_Registro();
                    thePanelTab1.SelectedIndex = 0;
                    statusRegReception = StatusRegRecep.reg_recep_saved;
                }
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Populate business object from data reader
        /// </summary>
        /// <param name="businessObject">business object</param>
        /// <param name="dataReader">data reader</param>
        internal void PopulateBusinessObjectFromReader(CPrice_version businessObject, IDataReader dataReader)
        {
            businessObject.Idprice_version = dataReader.GetInt32(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Idprice_version.ToString()));

            if (!dataReader.IsDBNull(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Idprice.ToString())))
            {
                businessObject.Idprice = dataReader.GetInt32(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Idprice.ToString()));
            }

            if (!dataReader.IsDBNull(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Idrecep_sample.ToString())))
            {
                businessObject.Idrecep_sample = dataReader.GetInt64(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Idrecep_sample.ToString()));
            }

            if (!dataReader.IsDBNull(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Num_version.ToString())))
            {
                businessObject.Num_version = dataReader.GetInt32(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Num_version.ToString()));
            }

            if (!dataReader.IsDBNull(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Cod_type_sample.ToString())))
            {
                businessObject.Cod_type_sample = dataReader.GetString(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Cod_type_sample.ToString()));
            }

            if (!dataReader.IsDBNull(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Idcompany.ToString())))
            {
                businessObject.Idcompany = (short?)dataReader.GetInt16(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Idcompany.ToString()));
            }

            if (!dataReader.IsDBNull(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Attention.ToString())))
            {
                businessObject.Attention = (short?)dataReader.GetInt16(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Attention.ToString()));
            }

            if (!dataReader.IsDBNull(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Iduser.ToString())))
            {
                businessObject.Iduser = (short?)dataReader.GetInt16(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Iduser.ToString()));
            }

            if (!dataReader.IsDBNull(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Num_days_post.ToString())))
            {
                businessObject.Num_days_post = dataReader.GetInt32(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Num_days_post.ToString()));
            }

            if (!dataReader.IsDBNull(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Date_creation.ToString())))
            {
                businessObject.Date_creation = dataReader.GetDateTime(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Date_creation.ToString()));
            }

            if (!dataReader.IsDBNull(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.User_creation.ToString())))
            {
                businessObject.User_creation = dataReader.GetString(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.User_creation.ToString()));
            }

            if (!dataReader.IsDBNull(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Num_days_valid.ToString())))
            {
                businessObject.Num_days_valid = (short?)dataReader.GetInt16(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Num_days_valid.ToString()));
            }

            if (!dataReader.IsDBNull(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Status_price.ToString())))
            {
                businessObject.Status_price = dataReader.GetInt32(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Status_price.ToString()));
            }

            if (!dataReader.IsDBNull(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Observation.ToString())))
            {
                businessObject.Observation = dataReader.GetString(dataReader.GetOrdinal(CPrice_version.CPrice_versionFields.Observation.ToString()));
            }
        }