// Ввод номеров в разделе РН private void RNMSerial_TextChanged(object sender, EventArgs e) { // Заводской номер ККТ if (RNMSerial.Text != "") { RNMSerialResult.Text = kkts.GetKKTModel(RNMSerial.Text); KKTSerial.FFDSupportStatuses[] statuses = kkts.GetFFDSupportStatus(RNMSerial.Text); RNMSupport105.BackColor = StatusToColor(statuses[0]); RNMSupport11.BackColor = StatusToColor(statuses[1]); RNMSupport12.BackColor = StatusToColor(statuses[2]); } else { RNMSerialResult.Text = "(введите ЗН ККТ)"; RNMSupport105.BackColor = RNMSupport11.BackColor = RNMSupport12.BackColor = StatusToColor(KKTSerial.FFDSupportStatuses.Unknown); } // ИНН пользователя RegionLabel.Text = ""; int checkINN = KKTSupport.CheckINN(RNMUserINN.Text); if (checkINN < 0) { RNMUserINN.BackColor = StatusToColor(KKTSerial.FFDSupportStatuses.Unknown); } else if (checkINN == 0) { RNMUserINN.BackColor = StatusToColor(KKTSerial.FFDSupportStatuses.Supported); } else { RNMUserINN.BackColor = StatusToColor(KKTSerial.FFDSupportStatuses.Planned); // Не ошибка } RegionLabel.Text = KKTSupport.GetRegionName(RNMUserINN.Text); // РН if (RNMValue.Text.Length < 10) { RNMValue.BackColor = StatusToColor(KKTSerial.FFDSupportStatuses.Unknown); } else if (KKTSupport.GetFullRNM(RNMUserINN.Text, RNMSerial.Text, RNMValue.Text.Substring(0, 10)) == RNMValue.Text) { RNMValue.BackColor = StatusToColor(KKTSerial.FFDSupportStatuses.Supported); } else { RNMValue.BackColor = StatusToColor(KKTSerial.FFDSupportStatuses.Unsupported); } }
// Генерация регистрационного номера private void RNMGenerate_Click(object sender, EventArgs e) { if (RNMValue.Text.Length < 1) { RNMValue.Text = KKTSupport.GetFullRNM(RNMUserINN.Text, RNMSerial.Text, "0"); } else if (RNMValue.Text.Length < 10) { RNMValue.Text = KKTSupport.GetFullRNM(RNMUserINN.Text, RNMSerial.Text, RNMValue.Text); } else { RNMValue.Text = KKTSupport.GetFullRNM(RNMUserINN.Text, RNMSerial.Text, RNMValue.Text.Substring(0, 10)); } }
// Изменение параметров, влияющих на срок жизни ФН private void FNLifeStartDate_ValueChanged(object sender, EventArgs e) { fnlf.FN15 = FNLife13.Checked; fnlf.FNExactly13 = FNLifeName.Text.Contains("(13)"); fnlf.GenericTax = GenericTaxFlag.Checked; fnlf.Goods = GoodsFlag.Checked; fnlf.SeasonOrAgents = SeasonFlag.Checked || AgentsFlag.Checked; fnlf.Excise = ExciseFlag.Checked; fnlf.Autonomous = AutonomousFlag.Checked; fnlf.FFD12 = FFD12Flag.Checked; fnlf.MarkFN = FNLife13.Enabled && FNLife36.Enabled || fns.IsFNCompatibleWithFFD12(FNLifeSN.Text); // Корректный ЗН ФН string res = KKTSupport.GetFNLifeEndDate(FNLifeStartDate.Value, fnlf); FNLifeResult.Text = "ФН прекратит работу "; if (res.Contains("!")) { FNLifeResult.ForeColor = Color.FromArgb(255, 0, 0); fnLifeResult = res.Substring(1); FNLifeResult.Text += (fnLifeResult + "\n(выбранный ФН неприменим с указанными параметрами)"); } else { FNLifeResult.ForeColor = Color.FromArgb(0, 0, 0); fnLifeResult = res; FNLifeResult.Text += res; } if (!(FNLife13.Enabled && FNLife36.Enabled)) // Признак корректно заданного ЗН ФН { if (!fnlf.MarkFN) { FNLifeResult.ForeColor = Color.FromArgb(255, 0, 0); FNLifeResult.Text += ("\n(выбранный ФН исключён из реестра ФНС)"); FNLifeName.BackColor = StatusToColor(KKTSerial.FFDSupportStatuses.Unsupported); } else { FNLifeName.BackColor = StatusToColor(KKTSerial.FFDSupportStatuses.Supported); } } else { FNLifeName.BackColor = StatusToColor(KKTSerial.FFDSupportStatuses.Unknown); } }